FFMPEG - Convert MP3 and JPEG to MP4, different JPEG to every MP3
I want to convert every MP3 with different JPEGs and output an MP4.
- mp3 and 1.jpg = 1.mp4
- mp3 and 2.jpg = 2.mp4
- mp3 and 3.jpg = 3.mp4 etc
How can I make code to get this right?
I use a batchfile
@echo off
mkdir converted
for %%a in ("*.mp3") do ffmpeg -i "%%a" -loop 1 -i image1.jpg -c:a copy -c:v libx264 -shortest "converted\%%~na.mp4"
pause
Something like this: Updated.....
@echo off
for %%a in (*.mp3) do call :CreateVideo "%%~a"
pause
exit
:CreateVideo
set /a Counter+=1
set CounterZero=000%Counter%
set CounterZero=%CounterZero:~-3%
ffmpeg -loop 1 -y -i "image%CounterZero%.jpg" -i "%~1" -shortest -acodec copy -vcodec libx264 "%~n1.mp4"
goto :EOF