Zombie Waffles
Zombie Waffles

Reputation: 195

Using FFmpeg to convert all images in a folder to mp4 or avi using a .bat file [Windows]

I'm trying to get all .png files in a folder to be converted into a video format in the same directory as the images. Now I can't understand how ffmpeg works, I just want something like this;

for /l %%k in (1,1,%images%) do (
    ffmpeg.exe (I need help with the parameters here) 
)

This is my very first help request ever and I'm not sure if I supplied enough information for this to be an easy answer. But at least TRYING to help me would be much appreciated. Thank you for reading!

Upvotes: 2

Views: 6412

Answers (1)

Zombie Waffles
Zombie Waffles

Reputation: 195

@echo off
set /p framerate=Enter framerate:
for /r %%a in (*.png) do (
    echo file '%%a' >> images.txt
)
ffmpeg.exe -r %framerate% -f concat -i images.txt -c:v libx264 -pix_fmt yuv420p video.mp4
del /q images.txt

Put this batch file AND ffmpeg.exe in the directory of all images Run the batch file and all images in that the current folder will be converted into an mp4 The batch file will automatically close after it has completed

Upvotes: 4

Related Questions