video converter - ffmpeg
September 25th, 2006 mysurface Posted in Misc, chmod, ffmpeg | Hits: 10357 |
I get to know this command because my mplayer having problem playing flv downloaded from youtube. Therefore I google it and found that it is a command line can actually convert it into mpg.
To convert flv, let say myvideo.flv to myvideo.mpg, you can do this:
ffmpeg -i myvideo.flv -ar 22050 -b 500 -s 320x240 myvideo.mpg
I check out man for ffmpeg, i couldn’t find at my local machine and I search from the internet, it is quite brief.
Anyway, -i is input, -ar is to set audio sample rate to 22050 Hz, -b is to make it DIVX compatible -s defines its video size.
I turn it into script so that it is easy to trigger next time.
#!/bin/sh
if [ -n "$1" -a -n "$2" ]
then
ffmpeg -i $1 -ar 22050 -b 500 -s 320×240 $2
else
echo “Usage: `basename $0` source.flv target.mpg”
fi
if [-n "$1" -a -n "$2"] is actually check to see if source and destination video is not specified, then display the usage.
Copy these line into a text file call flv2mpg and change it to executable by doing this
chmod a+x flv2mpg
So next time if want to convert to mpg, just do this
./flv2mpg myvideo.{flv,mpg}
Live Chat!









March 24th, 2007 at 6:26 am
I tried doing that but it said that the file is truncated and/or corrupted… and im not really sure what to do…
March 24th, 2007 at 6:35 am
And it says permission denied…
March 24th, 2007 at 3:09 pm
File truncated or corrupted probably means your flv, I am not sure, you didn’t mention what have you did to get this.
Same to permission denied, it probably means you haven’t chmod to the script? or other reason..
June 30th, 2007 at 5:55 pm
[...] -i is input file, -ar is audio rate in Hz. Just a slides of time, and you are done. And good thing about command line is you can put that into a bash script to do a batch converts. Related Posts video converter - ffmpeg I get to know this command because my mplayer having problem playing flv downloaded from youtube. Therefore I google it … [...]
September 10th, 2007 at 1:46 pm
hi..
i have tried this but its saying that “fmpeg.exe has encountered a problem and needs to close. We are sorry for the inconvenience.”
September 13th, 2007 at 12:54 pm
Your script is OK. I worked perfectly with me. Thanks!
January 20th, 2008 at 11:49 am
[...] beberapa situs yang membahas topik ini, antara lain adalah Linux By Examples yang membahas bagaimana “membungkus” ffmpeg menjadi sebuah skrip yang mudah [...]
May 6th, 2008 at 11:31 pm
Awesome post. Thanks for the info, very useful