Convert many video files in a folder at once

13 December 2025

Convert many video files in a folder at once

« Back
Table of Contents

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"

Pick a star to rate this

Leave a Reply

Your email address will not be published. Required fields are marked *

Unrelated Content

20 September 2025
FFmpeg Wizard Tool

To satisfy the continuously crawling web-search algorithms out there, I thought it would be a good idea to write this special post, to announce our brand new FFmpeg Wizard Tool. It's a really simple tool, but nevertheless it will hopefully be as useful to you as it has been for us. Just go try it […]

READ MORE
27 November 2020
Motivation behind this website

For every service that is offered for a lot of money on the internet, there's always a free or much cheaper alternative, especially if you embrace open-source software. For live-streaming this is also very much the case. We love that,

READ MORE
23 January 2021
Introduction to the new how-to article in the Knowledge Base.

I wrote a new guide on setting up your own live-stream server. Mostly due to your requests. I took the opportunity to simplify and shorten the guide a bit. If you follow this guide step by step, and use your brain a tiny bit, you'll be fine. This guide has so far been tested on […]

READ MORE
25 January 2021
Optimizing First-Frame Bitrate for HLS

When responding to an HLS request, the streaming server determines which video quality (i.e., ts file) the client will attempt to play before switching to a lower or higher quality video. This switch depends on available bandwidth and device type. Switching to the wrong quality first degrades the user experience considerably. For instance, sending a […]

READ MORE
25 January 2021
Adaptive Bit-rate Streaming

“What is adaptive streaming?” This question often leads to answers filled with technical terms like “HLS”, “MPEG-DASH”, “segments” and “codec“. This article is written for people who need to understand the principles, but don’t need to actually implement the technology. If you are looking for specific technical information on adaptive streaming then I recommend you read up on it on this website and elsewhere.

READ MORE
2 February 2021
About Bradmax Video Player WordPress plugin

Let's talk about our favorite video player plugin for WordPress. Here are some reasons why Bradmax Player is our favorite. And below that are detailed instructions on how to set it up. Setting it up may at first seem a bit awkward, but it really isn't. First you must obviously install the Bradmax Player plugin […]

READ MORE
Copyright © 2025. 
All rights reserved.
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram