6
votes

How can I automatically convert all MP4 files to FLV in a specific folder?

ffmpeg -i VID00002.MP4 -ar 44100 test.flv

Is there a way to queue these tasks, assuming that I don't know the file names?

If I need to run any scripts (I'm familiar with Python), how can I do that?

2

2 Answers

10
votes

You can do this fairly easy within the terminal, given you have ffmpeg installed. In your terminal, enter the following:

$>cd /your/path/to/videos
$>for i in *.mp4; do ffmpeg -i $i -ar 44100 $i.flv; done

The second command simply iterates through each mp4 file and assigns the filename to '$i'. You then call ffmpeg using $i as the input and output filename. For the output, you simply add the extension, in this case $i.flv. So, if your filename is 'video.mp4', it will output as 'video.mp4.flv'.

Hope this helps.

0
votes

This will convert and rename the new files using the find and ffmpeg functions and suppressing output questions:

find /mymediapath (\ -name '*.mp4' \) -exec bash -c 'ffmpeg -y -i "$0" -strict -2 "${0/mp4/flv}"' {} \;