video converter – ffmpeg

September 25th, 2006 mysurface Posted in chmod, ffmpeg, Misc | Hits: 56436 | 17 Comments »

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 320x240 $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}

17 Responses to “video converter – ffmpeg”

  1. I tried doing that but it said that the file is truncated and/or corrupted… and im not really sure what to do…

  2. And it says permission denied…

  3. 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..

  4. [...] -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 … [...]

  5. 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.”

  6. Your script is OK. I worked perfectly with me. Thanks!

  7. [...] beberapa situs yang membahas topik ini, antara lain adalah Linux By Examples yang membahas bagaimana “membungkus” ffmpeg menjadi sebuah skrip yang mudah [...]

  8. PSP Video Says:

    Awesome post. Thanks for the info, very useful

  9. YouTubeRobot.com today announces YouTube Robot 2.0, a tool that enables you to download video from YouTube.com onto your PC, convert it to various formats to watch it when you are on the road on mobile devices like mobile phone, iPod, iPhone, Pocket PC, PSP, or Zune.

    YouTube Robot allows you to search for videos using keywords or browse video by category, author, channel, language, tags, etc. When you find something noteworthy, you can preview the video right in YouTube Robot and then download it onto the hard disk drive. The speed, at which you will be downloading, is very high: up to 5 times faster than other software when you download a single file and up to 4 times faster when you download multiple files at a time.

    Manual download is not the only option with YouTube Robot. You may as well schedule the download and conversion tasks to be executed automatically, even when you are not around. Downloading is followed by conversion to the format of your choice and uploading videos to a mobile device (if needed). For example, you can plug in iPod, select the video, go to bed, and when you wake up next morning, your iPod will be ready to play new YouTube videos.

    Product page: http://www.youtuberobot.com
    Direct download link: http://www.youtuberobot.com/download/utuberobot.exe
    Company web-site: http://www.youtuberobot.com
    E-mail: support@youtuberobot.com

  10. [...] video converter – ffmpeg I get to know this command because my mplayer having problem playing flv downloaded from youtube. Therefore I google it … [...]

  11. Hi you there, and thanks for this powerful converter, it\’s so useful.

    I ask for: man ffmpeg, and the prompt just display it, I\’m using Ubuntu 9.04, but this should be the same for all distros.

    Anyway, thanX for the great info.

  12. I wanted to make an impression at a household reunion and recall the names of all of the new husband’s household members. There was one gent whom I’d asked his name and tried incredibly to bear in mind but failed repeatedly. Finally he bailed me out and said his name was Dick. Without a thought I swiftly said, “Gosh, how could I forget? You *look* like a ‘Dick’!!!”

  13. i think that download.com provides a comprehensive library of video converters that are spyware free -:’

  14. I am perplexed completely and this whole considered this topic scares me and I wish to get my pea mind around it earlier than I transfer ahead if you recognize what I mean.

  15. Greetings, this is a genuinely absorbing web weblog and I’ve cherished studying numerous of the content material and posts contained on the web internet site, maintain up the excellent operate and desire to read a great deal much more stimulating articles or blog posts inside the future.

  16. would want to appreciation for the attempts you get in writing this article. I am hoping a similar best work of your stuff sometime soon as well. The fact is your creative writing skills has inspired me to start out my own personal weblog now.

  17. As I website possessor I think the content here is rattling great , thankyou for your efforts.

Leave a Reply