How can I automatically convert all MP4 files to FLV with ffmpeg?
Asked Answered
G

2

6

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?

Grocer answered 20/12, 2010 at 5:4 Comment(0)
A
11

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.

Aphesis answered 13/7, 2011 at 15:46 Comment(1)
In windoze, the command looks like this: for %f in (*.m4a *.wma) do ffmpeg -i "%f" -acodec libmp3lame -ab 128k "%f.mp3"Rurik
P
0

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}"' {} \;
Polad answered 25/1, 2017 at 16:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.