[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
ffmpeg thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 80
Thread images: 10
File: file.png (8 KB, 518x178) Image search: [Google]
file.png
8 KB, 518x178
I have a bunch of .mp3 files, and I want to batch convert them all into video files, with a the same image as the video.

I found these two on the internet scripts:
to merge image.jpg and audio.wav
ffmpeg -loop 1 -i image.jpg -i audio.wav -c:v libx264 -tune stillimage -c:a aac -strict experimental -b:a 192k -pix_fmt yuv420p -shortest out.mp4

and this script to use a .bat file so I can drag and drop a bunch of files on a .bat file to convert them with ffmpeg:
for %%a in ("*.*") do ffmpeg -y -loop 1 -y -i folder.jpg -acodec copy -vcodec libx264 -shortest %%a.mkv
pause


but how can I make a .bat file, to merge all audio files I drop on the .bat file into video files with the same name as the audio files, without reconverting the audio files so it doesn't take so long?

please help
>>
>>53509531
>I found these two on the internet scripts:
these two scripts on the internet*
fucking dyslexia
>>
File: file.png (64 KB, 889x513) Image search: [Google]
file.png
64 KB, 889x513
why does this result in an error?
.bat file:
for /r %%X in (*.mp3) do (
ffmpeg -i -loop 1 -i folder.jpg -i "%%X" -shortest -c:v libx264 -c:a copy "%%".mp4
)
pause


please help
>>
>>53509922
it thinks loop is a filename, for what the console said
>>
>>53509975
my bad, I don't really understand ffmpeg, I got this off of google. removing the first "-i" fixed it, but how do I get it to output a file with the same name as the input file?

"%%".mp4 results in %.mp4
>>
>>53509975
>>53509922
yeah, get rid of the first -i
>>
>>53509985
how do I get it to output a file with the same name as the input file?
>>
>>53509531
Try this, in the dir of your files
find -type f -iname '*.wav' | parallel --eta ffmpeg -i '{}' -i test.png -map 0:0 -map 1:0 -c copy -acodec copy -vcodec libx264 '{.}.mkv';
>>
I have an especially fucked up mp3 file.
It seem to be a couple of different ones just concatenated together, and it sometimes jumps ahead or back in the recording.

Anyone know how I can analyse this or fix it?
>>
>>53509983
it's string syntax stuff, look up what it is for windows shell
>>
>>53510021
>Not backing it up before working on it
How people this stupid are still alive baffles me.
>>
>>53510020
is that for windows? doesn't work.
>>
>>53510048

Well he will remember from now on, thats for sure.
>>
>>53510048
ffmpeg doesn't effect the source files.
>>
>>53510054

Linux. You better off using cygwin or some shit like that. Cli in windows is just insane.
>>
>>53510048
I have multiple copies.
I got it in this fucked-up manner.

What gave you the impression that I did it?
>>
>>53510021
you could use a waveform analyzer like audacity, although good fucking luck doing anything else
>>
>>53510254
>waveform analyzer like audacity
for what?

The file is fucked. I already know that.
I'm wondering how I can unfuck it. passing it through ffmpeg once made it seekable at least.
>>
Let me see if I read your problem correct.

You have a.mp3, b.mp3, c.mp3 and a.jpg, b.jpg, c.jpg. You want to combine them into a.mp4 b.mp4 c.mp4

Then concat these mp4 files into a larger mkv without reconverting?
>>
>>53510275
you said the files skip around, so the waveform would give you good info on where to snip.

captcha: erry dennis
>>
>>53510279
I fixed it with the help of another anon in another thread.
bat file is now:

for /r %%X in (*.mp3) do (
ffmpeg -i "%%X" -i folder.jpg -map 0:0 -map 1:0 -c copy -acodec copy -vcodec libx264 "%%~nX".mp4
)
pause


the folder has a bunch of mp3 files and 1 folder.jpg
>>
>>53510302
I can't pick it out easily in the waveform.
>>
>>53510307
>>53510279
MPV can open the file, but MPC-HC can't and youtube gets stuck at processing it. I think it's because of the framerate. How can it force it to have a normal framerate so that mpc-hc can open it and youtube can process it?
>>
File: 1442588923144.gif (266 KB, 241x238) Image search: [Google]
1442588923144.gif
266 KB, 241x238
>>53510307
>winbabbies playing with their crippled cli
>>
>>53511823
can you at least help me?
>>
Here anon, have fun:

for %%i in ("*.mp4") do ffmpeg -y -i "%%i" \SHIT GOES HERE\ -pass 1 -f webm NUL && ffmpeg -y -i "%%i" \SHIT GOES HERE\ -pass 2 %%~dpni.webm

for %%i in ("*.mp4") do ffmpeg -y -i "%%i" \SHIT GOES HERE\ %%~dpni.webm
>>
>>53512398
can you explain it? I'm assuming that I shouldn't use both of those lines, correct?
>\SHIT GOES HERE\
wait, what goes there exactly? the folder.png?
>>
>>53512466
>no
first line is twopass, second isn't.
>shigoeshere
means codec/bitrate/size etc
>-i image.jpg
goes after "%%i"
If you're doing two pass use a single line, don't push the second pass down
>>
>>53512568
how can I make sure it doesn't take ages since it's just a still image that needs to be visible for the duration of the .mp3 file? like just a 1fps video track of a still image (folder.png) with a fairly low bitrate?
>>
>>53512568
>>53512398
thanks for the help anon, but I can't get it to work. can you please help?

my setup is as follows:

folder containing a single png image (folder.png) and a bunch of mp3 files
>>
>>53512616
>>53512759

Still image doesn't take long to encode, test this in any image

ffmpeg -y -loop 1 -i image.jpg -i sound.mp3 -c:v libvpx -b:v 500k -c:a libvorbis -b:a 128k -shortest Test.webm


if it works for you (it does for me) then i make the batch command for you.
>>
>>53512814
it works but it's converting the audio as well, which is taking long, because the mp3 files I'm using are podcasts of multiple hours, so can you make it so that it just copies the mp3 file inside the video container without converting the audio? also, can you make it so the video framerate is really low?
>>
>>53512929
Webm doesn't support MPEG audio, it only supports Vobis (ogg) and Opus (also ogg).
If you had those mp3's converted to ogg vorbis you could use the copy "codec" which makes a ton faster than encoding.
>>
>>53513030
can't we use .mp4 instead of webm?
>>
>>53513048
I think it may work, let me test it.
>>
File: meh.jpg (21 KB, 586x69) Image search: [Google]
meh.jpg
21 KB, 586x69
>>53513064
it works (more less) but the file output is huge (really huge)
>>
>>53513202
but if the audio is copied, then all of that size is of the video, right? can you make it a 1fps video or something? and have the keyframes really apart (once every 300fps or something)
>>
>>53513228
I just found out that the audio is not the problem (it can be easily encoded), the video is the one who need to be encoded.

About the keyframe. I'm trying to see how it works right now
>>
>>53513445
yeah just copying the audio without encoding is fine, the video should be encoded
>>
>>53513473
the audio NEEDS to be encoded
here's your batch
for %%i in ("*.mp3") do ffmpeg -y -i "%%i"  -r 1 -i image.jpg -loop 1 -segment_times 00:01:00 -c:v libvpx -c:a libvorbis -b:a 500k %%~dpni.webm


adjust the audio bitrate, the output file is the same as the mp3 input
>>
>>53513587
>the audio NEEDS to be encoded
only if you go with webm, but if you go with mp4, you can use -c:a copy instead
>>
>>53513587
this is the test i made >>>/wsg/991378

>>53513614
yeah, but webm is smaller and the way i did makes encoding faster

updated version:
for %%i in ("*.mp3") do ffmpeg -y -i "%%i"  -r 1 -i image.jpg -loop 1 -segment_times 00:01:00 -c:v libvpx -c:a libvorbis -b:v 50M -b:a 500k %%~dpni.webm
>>
File: a.webm (73 KB, 640x360) Image search: [Google]
a.webm
73 KB, 640x360
Have you tried sub fraction aka AMD video framerates?

ffmpeg -i big_buck_bunny.mp4 -ss 5 -an -c:v libvpx -b:v 2M -y -r 0.05 a.webm


Despite the high bitrate you get a very small video stream since they only have like 4 frames total.
>>
>>53513726
is that possible with mp4 format?
>>
>>53513704
>yeah, but webm is smaller and the way i did makes encoding faster
yes, this is great when the audio is about 5 minutes long, but it will take ages to do about 100 episodes of 3-4 hour podcasts. which is why copying the mp3 file instead of encoding it is a must in this case. I will use the webm version for other purposes.
>>
>>53513704
MP4 ver
for %%i in ("*.mp3") do ffmpeg -y -i "%%i"  -r 1 -i image.jpg -loop 1 -segment_times 00:01:00 -c:v libx264 -c:a copy -b:v 500M %%~dpni.mp4


>>53513808
If you're doing the mp4 copy, sometimes the filesize is smaller than webm. But one thing for sure, encoding mp4 is way faster.
>>
File: file.png (92 KB, 1361x638) Image search: [Google]
file.png
92 KB, 1361x638
>>53513704
>>updated version:
>
for %%i in ("*.mp3") do ffmpeg -y -i "%%i"  -r 1 -i image.jpg -loop 1 -segment_times 00:01:00 -c:v libvpx -c:a libvorbis -b:v 50M -b:a 500k %%~dpni.webm

pic related
>>
>>53514072
try to specify the image size with "-s 400x400" or change the video bitrate to something smaller like "5000k"
>>
File: meh.png (222 KB, 450x567) Image search: [Google]
meh.png
222 KB, 450x567
Just noticed, are you trying to the same as "Album art" like picture related?
>>
>>53514197
no it needs to have a real video track, so that I can upload these podcasts (are now as mp3 files) to youtube
>>
>>53513779
Apparently yes: https://a.pomf.cat/vtiulq.mp4

 ffmpeg -loop 1 -i Dyson.png -i zombi.mkv -map 1:1 -map 0 -c:a libvorbis -c:v h264 -crf 18 -preset slow -tune zerolatency -pix_fmt yuv420p -y -r 0.05 -t 0:01:33 -q:a 3 desu.mp4

video:70kB audio:1175kB subtitle:0kB other streams:0kB global headers:4kB muxing overhead: 3.997015%


Not sure if YT accepts that.
>>
ffmpeg -loop 1 -i folderpng -i testaudio.mp3 -map 1:1 -map 0 -c:a libvorbis -c:v h264 -crf 18 -preset slow -tune zerolatency -pix_fmt yuv420p -y -r 0.05 -t 0:01:33 -q:a 3 desu.mp4


this results in no sound
>>
what if I just convert all audio files to .ogg before this, can we have it copy the audio and make a video track that is as small as possible since framerate can be extremely low because it's a still image?
>>
>>53509531
I must be a complete faggot for never thinking of an easier way to get this done. I've been uploading video game music on and off for the last 5 years using Sony Vegas.
I hope you get what you want OP.
>>
>>53514629
you can do that. you should be able to strip out everything but the -loop, -i, and the output name. and the values with the other flags of course.
>>
>>53514660
what I wanted, I can't really get to work, but I finally went with this for now:

for /r %%X in (*.mp3) do (
ffmpeg -i "%%X" -i folder.mp4 -map 0:0 -map 1:0 -c copy -acodec copy -vcodec copy -shortest "%%~nX".mp4
)
pause


I wanted to upload 100+ episodes of a podcast to youtube, and since I wanted them all to have the same image as video track, I used adobe premiere (could have been done with movie maker or vegas) and made a video out of that still image that was longer than my longest audio file (5h50m), then I exported that video at 500K bitrate, 10fps with a keyframe every 300 frames to keep the video track small in size.

This way, I'm just copying the mp3 file, together with the video file I created, and the new output cuts off where the mp3 file stops.
>>
>>53514746
I would love a way to get this sort of work done with just ffmpeg and an image&audio instead of a video file and audio files.

>>53514720
do you use windows? if so, can you test it out and see if mpc-hc plays it correctly (because then youtube won't reject it). Some output files work fine in MPV but youtube rejects them and mpc-hc doesn't play them correctly
>>
>>53514746
that's a pretty sledgehammer approach for the video. It only has to be as big as the picture, really.

something like this is what I use for /wsg/
 ffmpeg -i pic.jpg -i song.mp3 -c:a libvorbis -c:v libvpx -b:a 192K out.webm

You don't have to worry about the video in this case.
I don't know how this meshes with your filename stuff, though.
ffmpeg is kind of a pain, huh. At least you only have to do this once.
>>
File: file.png (25 KB, 861x149) Image search: [Google]
file.png
25 KB, 861x149
>>53514819
yeah, it's really a pain and the couple of GUIs available are extremely basic, where most features aren't even available.

>
 ffmpeg -i pic.jpg -i song.mp3 -c:a libvorbis -c:v libvpx -b:a 192K out.webm

this gets me pic related. I don't understand wtf it wants me to do
>>
>>53514892
works on my machine(tm)

post ffmpeg -version

ffmpeg version 3.0 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.3.0 (GCC)
configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libdcadec --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-shared --enable-version3 --enable-x11grab
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
>>
File: file.png (58 KB, 1042x439) Image search: [Google]
file.png
58 KB, 1042x439
>>53514967
>>
File: file.png (43 KB, 936x314) Image search: [Google]
file.png
43 KB, 936x314
>>53514967
using another image file (jpg this time) I get this:
>>
>>53514892
>header missing
try another song
or just try again
>>
>>53515070
* it does create a webm file, but the file has no sound and the screen is black when played with mpc-hc

>>53515073
I did
>>
>>53515070
well guess what nigger it works
congrats
>>
>>53515083
no because now I'm back to square one. the file works only in MPV, youtube rejects it, and MPC-HC can't open and play it
>>
>>53515088
that's a library problem. you can upload it here and it works, though. just use switch it out for MP4 codecs for YT.
run
ffmpeg -codecs
and find them.
>>
>>53515123
>that's a library problem
how can I fix that?
>>
>>53515123
even this results in the same (mpc-hc not showing it, and youtube recognizing it as an invalid file, stuck on processing)
ffmpeg -i pic.jpg -i song.mp3 -c:a copy -c:v libx264 -b:a 192K out.mp4
>>
>>53515233
changing the lib* words in the code to whatever the mpeg and mp4 codecs are. the names are given by the above statement.
>>
>>53515264
https://support.google.com/youtube/answer/1722171?hl=en
>>
>>53515279
yeah but there's something wrong with the output file, otherwise mpc-hc should be able to play it.
>>
>>53515296
throw it up on pomf.cat
>>
>>53515343
wtf.. it works on pomf.cat

wtf is wrong with mpc-hc? jesus christ

https://a.pomf.cat/erhxro.webm
>>
>>53515392
>>53515343
the thing is, that this file:
https://a.pomf.cat/erhxro.webm

doesn't process on youtube (processing gets stuck forever, never to finish)

so for some reason, both youtube and mpc-hc have trouble playing this file
>>
>>53515438
you need the aac codec too
at least that's what I'd do
>>
>>53515451
okay okay
try -c:a aac -c:v mpeg4
>>
>>53515499
and get rid of the -b:v stuff
>>
>>53515507
nvm that was only for a transcoding test I did with a webm
>>
>>53515499
aac works as well, but since it's mpeg4, I can just copy the audio.
for /r %%X in (*.mp3) do (
ffmpeg -i "%%X" -loop 1 -i pic.png -c:a copy -c:v mpeg4 -b:v 5K -shortest -r 1 "%%~nX".mp4
)
pause


anyone know how I can make the video track transcode a lot faster? can I change the keyframes? (keyframe every xnumber of frames)
Thread replies: 80
Thread images: 10

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.