2

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.

1
  • 5
    What about a simple for loop? for i in *.mkv;do ffmpeg -i "$i" …;done Commented Jul 22, 2012 at 15:14

2 Answers 2

3

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 
0
1

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

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

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.