I've been making image videos with FFmpeg using the following:
I want to make about 60 of them using sequential image and audio files:Code:ffmpeg -loop 1 -i Image01.jpg -i Aud01.mp3 -c:v libx264 -tune stillimage -c:a aac -strict experimental -b:a 192k -pix_fmt yuv420p -shortest Vid01.mp4
ffmpeg -loop 1 -i Image01.jpg -i Aud01.mp3 -c:v libx264 -tune stillimage -c:a aac -strict experimental -b:a 192k -pix_fmt yuv420p -shortest Vid01.mp4
ffmpeg -loop 1 -i Image02.jpg -i Aud02.mp3 -c:v libx264 -tune stillimage -c:a aac -strict experimental -b:a 192k -pix_fmt yuv420p -shortest Vid02.mp4
ffmpeg -loop 1 -i Image03.jpg -i Aud03.mp3 -c:v libx264 -tune stillimage -c:a aac -strict experimental -b:a 192k -pix_fmt yuv420p -shortest Vid03.mp4
Is there an simple way of joining the commands so I don't have to repeat the process 60 times. I've tried && but it only outputs the final vid file.
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 4 of 4
Thread
-
-
Here's a batch file I came up with:
Code:@echo off SetLocal EnableDelayedExpansion :START Set /a COUNTER=0 :Cycle SET COUNTER=0%COUNTER% set PICNAME=Image%COUNTER%.jpg set VIDNAME=Vid%COUNTER%.mp4 set AUDNAME=Aud%COUNTER%.mp3 @echo on ffmpeg -loop 1 -i %PICNAME% -i %AUDNAME% -c:v libx264 -tune stillimage -c:a aac -strict experimental -b:a 192k -pix_fmt yuv420p -shortest %VIDNAME% @echo off if errorlevel 1 goto Done set /A COUNTER=COUNTER+1 if %COUNTER% GTR 60 goto Done goto Cycle :Done pause
I found this site helpful: https://www.robvanderwoude.com/battech_leadingzero.php -
Here is a batch that is a little shorter that works for me. I didn't have mp3 available on short notice so I used mp2 audio. Shouldn't make a difference. Since your request was with Images starting with 1 with leading 0, I added the 'If LSS...' script to decide whether to add a zero to the filename or not.
I added the %%dpa in case the images are in a different folder than this CMD file.
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
set count=1
for %%a in (*.jpg) do (
IF !count! LSS 10 (
ffmpeg -loop 1 -i "%%~dpaimage0!count!.jpg" -i Aud0!count!.mp2 -c:v libx264 -tune stillimage -c:a aac -strict experimental -b:a 192k -pix_fmt yuv420p -shortest Vid0!count!.mp4
) ELSE (
ffmpeg -loop 1 -i "%%~dpaimage!count!.jpg" -i Aud!count!.mp2 -c:v libx264 -tune stillimage -c:a aac -strict experimental -b:a 192k -pix_fmt yuv420p -shortest Vid!count!.mp4
)
set /a count+=1
)
Similar Threads
-
batch merge videos and audios with ffmpeg
By m0ck in forum Video ConversionReplies: 6Last Post: 27th May 2021, 08:12 -
Batch add intro to Videos using FFMPEG
By dexterfox44 in forum EditingReplies: 2Last Post: 10th Jun 2020, 19:32 -
Remove Intro from videos in Batch using FFMPEG
By dexterfox44 in forum EditingReplies: 1Last Post: 14th Oct 2019, 22:01 -
Batch Remove Intro from videos using FFMPEG
By dexterfox44 in forum Newbie / General discussionsReplies: 1Last Post: 14th Oct 2019, 14:57 -
Batch trim Videos using FFMPEG
By dexterfox44 in forum Newbie / General discussionsReplies: 1Last Post: 14th Oct 2019, 13:11