FFMPEG Batch Convert for Windows

32,861

Solution 1

for /f "tokens=1 delims=." %a in ('dir /B *.avi') do ffmpeg -i "%a.avi" "%a.mp4"

This is for cmd window usage, if you want to use it in the batch script, than double all percent signs. You have run it in directory where your videos reside.

Solution 2

In order to make ffmpeg batch encoding easier for Windows users, I developed this free open-source application using .NET/C#. I would like to include it here as an addtional choice to make things easier for some Windows users who may not be so familiar with command-line operation.

https://sourceforge.net/projects/ffmpeg-batch

Solution 3

If you have multiple periods in your file names, you can use this method instead:

for /r C:\path\ %a in (*.avi) do ffmpeg -i "%a" "%~pa%~na.mp4"

Just edit "C:\path\" as necessary.

Share:
32,861
Ash_dog
Author by

Ash_dog

Updated on April 12, 2020

Comments

  • Ash_dog
    Ash_dog about 4 years

    I've been trying to convert entire folders of files using ffmpeg for a long time now. I've searched the web, found various answers, but none that helped me. Currently I'm using multiple instances of ffmpeg to convert more than one file at a time. But it's very time consuming and annoying to type in everything all the time, even with copy/paste.

    To simplify my current code it would look something like this. I specify the input file and the output format (+ various settings):

     ffmpeg -i "EXAMPLE.avi" newEXAMPLE.mp4
    

    But what I would like is a single instance of ffmpeg to convert all files in a specific folder to a new format and for the files to keep their original name.

    example1.avi > example1.mp4

    example2.avi > example2.mp4

    example3.avi > example3.mp4

    and so on...

    PS. I'm a bit new to these kind of things, so I'd much appreciate an explanation with your answer, so I can understand and learn. Thank you!