Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

ffmpeg

mp4

flv

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?

like image 651
CIF Avatar asked Dec 20 '10 05:12

CIF


People also ask

Can FFmpeg convert FLV to mp4?

FFmpeg is a command line based tools which allows to do very neat video manipulations. We would like to share this small script, which our IT specialists have used for one of our video conversion projects. It parses a directory, finds all flv (Flash video) files and converts them to mp4.

Does FFmpeg work with mp4?

FFmpeg can input most container formats natively, including MP4, . ts, MOV, AVI, Y4M, MKV, and many others. This is the output file.


1 Answers

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.

like image 101
OV Web Solutions Avatar answered Oct 13 '22 12:10

OV Web Solutions