FFMpeg Batch Image + Multiple Audio to video - ffmpeg

Im trying to do the following with FFMpeg I want to create multiple videos with one image and different audio files (music albums). These are my own albums so I have rights to do so before you ask. I have 100's of audio files to stick up on youtube.
Is there a way I can create this in batch so i can just load one image (album cover) and multiple audio files (the album tracks) and get videos to the tracks length automatically?
Appreciate any help

i use this portion of code to do the conversion for my YouTube video:
for %%a in ("*.*")
do
"C:\ffmpeg\bin\ffmpeg" -loop 1 -i "C:\ffmpg\bin\input.jpg" -i "%%a" -c:v libx264 -preset veryslow -tune stillimage -crf 18 -pix_fmt yuv420p -vf scale=854:480 -c:a aac -shortest -strict experimental -b:a 192k -shortest "C:\mp4\%%~na.mp4"
pause
"C:\ffmpeg\bin\ffmpeg" the folder of codec
"C:\ffmpg\bin\input.jpg" image path
"C:\mp4\%%~na.mp4" output folder
-vf scale=854:480 you can specify the resolution of your video 16:9 for youtube video
-c:a aac -shortest use aac codec, by specify -shortest the video length will match the audio length
if there an error use libvo_aacenc instead of aac codec like that:
-c:a libvo_aacenc -shortest -strict experimental
i hope that help

Im trying almost same thing, look how ive done:
#echo off
set /P format="Type the Video Format: "
for %i in (*.%format) <<<< geting not a reconiezed by CMD
do #echo file '%i' > Lista-%format%.txt
mylist=Lista-%format%.txt
ffmpeg.exe -i %mylist% -vf scale=480:320 output-%mylist%.%format%

Related

ffmpeg convert audio to ogg and keep album cover

If I convert an audio file with an album cover thank's to:
ffmpeg -i sample1.flac -ar 48000 -vn -c:a libvorbis -b:a 320k sample1.ogg
My sample1.ogg file doesn't have any album cover. Is there a way to ask explicitly to ffmpeg to keep the cover ?
instead "-vn" write "-c:v libtheora -q:a 10".
-vn - means no video, picture is frame of video in ffmpeg
Sum up of answers I found: Remove the option -vn which means: no video, because thumbnail are frame of video. Use libtheora instead of libvorbis. If you get a bitrate error, remove option -b:a 320k. At the end we get:
ffmpeg -i file.flac -c:v libtheora -q:v 10 -c:a libvorbis file.ogg
This gives you a file with an audio and a video content.
If you prefer to extract thumbnail in a separate file (to re-add it later for example), use:
ffmpeg -i file.flac -an -vcodec copy thumbnail.jpg
Thank's to Баяр Гончикжапов for his help and answers!

ffmpeg audio watermark at specific time

I'm looking for a way to add an audio watermark, on specific time, to a video file (with existing audio) . something like: ffmpeg -i mainAVfile.mov -i audioWM.wav -filter_complex "[0:a][1:a] amix=inputs=2:enable='between(t,9,10)' [aud]; [0:v][aud]" -c:v libx264 -vf "scale=1280:720:sws_dither=ed:flags=lanczos, setdar=16:9" -c:a libfdk_aac -ac 2 -ab 96k -ar 48000 -af "aformat=channel_layouts=stereo, aresample=async=1000" -threads 0 -y output.mp4
The above command gives me this error Timeline ('enable' option) not supported with filter 'amix'. amerge didn't work as well. I kind of get lost with filter_complex syntax, specifically with the following conditions
On the main AV file, both audio and video tracks are filtered
Watermark should be between the 9th and 10th second (I already
generated a 1 second, 10k tone file)
The watermark need to survive the proceeding audio transcode
Use
ffmpeg -i mainAVfile.mov -i audioWM.wav
-filter_complex
"[0:a]aformat=channel_layouts=stereo,aresample=async=1000[main];
[1:a]atrim=0:1,adelay=9000|9000[wm];[main][wm]amix=inputs=2"
-vf "scale=1280:720:sws_dither=ed:flags=lanczos,setdar=16:9" -c:v libx264
-c:a libfdk_aac -ac 2 -ar 48000 -b:a 96k
-threads 0 -y output.mp4
It's preferable to perform all filtering in a single filtergraph. But I've kept the video filter as-is.

ffmpeg: Proper way to encode ac3 to aac?

I have actually encoded an audio file from ac3 to aac using ffmpeg native aac encoder but the issue is that the file is not playing correctly , more specifically i have played that file in different media player but most of them start from 19 seconds and in vlc it is not even starting till I seek to more than 19 seconds duration.
command i have used is :-
ffmpeg -i source.mkv -map 0:a:0 -c:a aac audio.mp4.
That is the proper way.
Don't know if this will make a difference, try -b:a 400k and -strict experimental.
If you want audio only, convert to m4a or aac.
ffmpeg -i input.mkv -y -c:a aac -b:a 400k -map 0:a:0? -strict experimental output.mp4
Other encoders, may require compiling ffmpeg with use flags:
http://trac.ffmpeg.org/wiki/Encode/AAC
libfdk_aac
libfaac

FFMPEG - Chaining commands for time lapse, size, and h.264 recursively through a directory

Working on converting videos over a directory structure. Currently I tried this:
for i in *.mov; do
ffmpeg -i "$i" -filter:v "setpts=0.1*PTS" -an -c:v libx264 -preset slow -crf 20 -c:a libvo_aacenc -b:a 128k "${i/-lapse.mov}"
done
Didn't get to the resizing but already realize this won't work this way.
Trying to make it work in this order: Timelapse video, convert size to X x Y, and make sure quality is decent.
Haven't worked too much with FFMPEG so any help is appreciated.
thanks.
Are you trying in windows? Is it MS-DOS command? If that is the case, you need to correct your command as below:
for %%i in (*.mov) do (
ffmpeg -i "%%i" -filter:v "setpts=0.1*PTS" -an -c:v libx264 -preset slow -crf 20 -c:a libvo_aacenc -b:a 128k "%%i-lapse.mov")
If it is anything to do with ffmpeg errors, rather than dos command format errors, please do post the error that you observe

Getting the original video quality while converting in ffmpeg

In my site, having upload video(only mp4 videos) functionality and then to combine. For the combining i used Mp4Box, If we want combine all the mp4 video, those videos have to same dimesions,bitrate,codecs,samplerate,etc, So while uploading the mp4 videos itself we set the constant dimension and other details like
ffmpeg -i test.mp4 -r 25 -s 640x360 -ar 48000 -acodec copy -f mp4 -vcodec libx264 -vpre default -async 1 -strict -2 -qscale 10 test.mp4
After using this command the video quality will loss fro the original video, Kindly suggest any solution?
Add
-qp 0
§ Lossless H.264

Resources