I have several video files in a directory and I want to convert all of them into other video formats.
Is there any way that I can convert all of them in just one go using FFMPEG. I mean without having to make a shell script for doing so.

  • 5
    What about a simple for loop? for i in *.mkv;do ffmpeg -i "$i" …;done – Marco Jul 22 '12 at 15:14

The easiest way would be to use a for loop of your shell of choice. This task is so simple, you can just use the prompt, there's no need to create a shell script.

Here is the one-liner as an example for the widely-used bash (and compatible):

for i in *.mkv; do ffmpeg -i "$i" … ;done

I just did such a conversion starting from Marco's solution. I added changing the file extension, in my case, from .mp4 to .mp3:

for i in *.mp4; do ffmpeg -i "$i" -codec:a mp3 "mp3/${i%.mp4}.mp3";done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.