Convert many video files in a folder at once
I've been fooling around with Ai a lot these last few months. And one thing that I want to try is am Ai powered, automatic, music video clip generator. But, for this to work, all the input video's will need to have the same dimensions. But, the videos I want to use, are all different, in resolution, bitrate and even file extension, going from Avi, to M4a, and also Mov, Mkv and Mp4. My goal here is to use one FFmpeg command, and then sit back, and wait an eternity for it to finish. When it finishes this task, I should have a folder containing a bunch of Mp4 files, all using 1280x720 px. I used the following command to achieve this:
for %f in (*.avi *.mov *.mp4 *.m4a *.mkv) do ffmpeg -i "%f" ^
-vf "scale='if(eq(iw,1280)*eq(ih,720),iw,1280)':'if(eq(iw,1280)*eq(ih,720),ih,720)':force_original_aspect_ratio=decrease,pad=1280:720:(ow-iw)/2:(oh-ih)/2" ^
-c:v libx264 -crf 20 -preset medium -pix_fmt yuv420p ^
-c:a aac -b:a 192k "out_%~nf.mp4"


Recent Comments