Convert .flv (Google Videos) to .mpg using ffmpeg

Sponsored Link
FFmpeg is a complete solution to record, convert and stream audio and video. It includes libavcodec, the leading audio/video codec library. FFmpeg is developed under Linux, but it can compiled under most operating systems, including Windows. In ubuntu This package contains the ffplay multimedia player, the ffserver streaming server and the ffmpeg audio and video encoder. They support most existing file formats (AVI, MPEG, OGG, Matroska, ASF, ...) and encoding formats (MPEG, DivX, MPEG4, AC3, DV, ...).

ffmpeg Features

  • ffmpeg is a command line tool to convert one video file format to another. It also supports grabbing and encoding in real time from a TV card.
  • ffserver is an HTTP (RTSP is being developped) multimedia streaming server for live broadcasts. Time shifting of live broadcast is also supported.
  • ffplay is a simple media player based on SDL and on the FFmpeg libraries.
  • libavcodec is a library containing all the FFmpeg audio/video encoders and decoders. Most codecs were developped from scratch to ensure best performances and high code reusability.
  • libavformat is a library containing parsers and generators for all common audio/video formats.

Install ffmpeg Ubuntu

sudo apt-get install ffmpeg

convert .flv to .mpg using ffmpeg

First you need to download your .flv file to a folder and you need to Open a terminal window and go in to the .flv file folder and type the following command

ffmpeg -i jokes.flv -ab 56 -ar 22050 -b 500 -s 320×240 jokes.mpg

jokes.flv is the file you want to convert, so the name must be the same as the source file.You can name jokes.mpg whatever you want as long as it has the .mpg extension.

-b bitrate: set the video bitrate in kbit/s (default = 200 kb/s)

-ab bitrate: set the audio bitrate in kbit/s (default = 64)

-ar sample rate: set the audio samplerate in Hz (default = 44100 Hz)

-s size: set frame size. The format is WxH (default 160×128 )

Sponsored Link

Related posts

You may also like...

42 Responses

  1. Ben says:

    Great!

    Thanks very much for your effort!

    Greetz 😉

  2. Alephcat says:

    if the video is available on the Google Video site you just need to click on the “Download” button, cancel the download of the Google video player then in the bit of the sidebar that has just expanded click on the “Manually download the video” link. Save the file then open it with a text editing program such as notepad or Gedit. Once open look for the section of text starting “url:http://vp.video.google.com/videodownload” copy everything after the “url:” up to just before “docid:” and paste it into firefox (may work with other browsers but I have only tested this with firefox) and save the .AVI file when it asks you to.

  3. Hans-Werner says:

    Given that FLV plays fine in ffmpeg-based media players (more or less all media players) — what’s the point in making MPEGs from them? Well, OK, if you really want to make a VCD of them, right. But then you’d have to use other encoding parameters. Also, I don’t see any point in scaling the small video to a larger size before encoding. That just introduces some extra quality loss for a fixed bandwith.

    BTW: With more or less any flash-based embedded video player, you can “pause” the video, wait until it is completely downloaded (since FLV media is *not* real-time streaming data) and then have a look in either /tmp (most Flash video players) or the Browser cache directory (e.g. the MySpace FLV player). The FLV is waiting there to get copied 🙂 No need for “download” links which in most cases offer only quality-reduced versions for mobile phones anyway.

  4. Download says:

    Thanks

    very nice

  5. giuseppe says:

    i have ffmpeg and i used a guide when i firstr found it the command i used was something like ffmpeg -ie get.flv get.wma and it worked the only pproblem is i forgot the command and i need to make mp3 files for my song colection…

  6. Marc de Vries says:

    Can i convert wma to flash with ffmpeg for windows?

  7. ????? says:

    convert .flv to .mpg using ffmpeg

    nice work

  8. ????? says:

    good work man 🙂

  9. Paul Dufresne says:

    Seems that to convert to VCD format you just have to:
    ffmpeg -i input.flv -f vcd output.mpg

  10. ??????? says:

    Can i convert wma to flash with ffmpeg for windows?

    yeaha

  11. ????? says:

    thank you

    very nice

  12. ????? says:

    its good job

  13. ??? says:

    Thank you very much ,,

  14. ????? says:

    appreciate it ,,,,,,,,

  15. m7mmad says:

    Thanks for sharing this useful info … regards

  16. s-h-o-a-i-b says:

    Thanks for sharing but its useless again bunch of files which is most likely to be the case when downloading a few clips and wanna batch them in to one job.

    For bunch of files in a folder you can do this

    for file in `file -1`; do `ffmpeg -i $file -ab 56 -ar 22050 -b 500 -s 320×240 $file.mpg`; done

  17. bassam says:

    can i convert rmvb to mpeg?

    i wont search if i can, ubuntu is the best.

    thank you.

  18. nobody says:

    use..

    /usr/bin/ffmpeg -i “/home/me/film.avi” -vcodec flv -f flv -r 29.97 -s 320×240 -aspect 4:3 -b 300kb -g 160 -cmp 2 -subcmp 2 -mbd 2 -flags +aic+cbp+mv0+mv4+trell -ac 1 -ar 22050 -ab 56k “/home/me/film.flv”

    ..or..

    /usr/bin/ffmpeg -i “/home/me/film.avi” -vcodec flv -f flv -r 29.97 -s 320×180 -aspect 16:9 -b 300kb -g 160 -cmp 2 -subcmp 2 -mbd 2 -flags +aic+cbp+mv0+mv4+trell -ac 1 -ar 22050 -ab 56k “/home/me/film.flv”

    😉

    have fun

  19. nobody says:

    And backwards..

    /usr/bin/ffmpeg -i “/home/me/film.flv” -target ntsc-dvd -r 29.97 -s 720×480 -aspect 4:3 -b 8000k -mbd rd -flags +trell -mv0 -cmp -subcmp 2 “/home/me/film.mpg”

    ..or..

    /usr/bin/ffmpeg -i “/home/me/film.flv” -target ntsc-dvd -r 29.97 -s 720×480 -aspect 16:9 -b 8000k -g 12 -mbd rd -flags +trell -mv0 -cmp -subcmp 2 “/home/me/film.mpg”

  20. paul says:

    I use my step 1 to convert using ffmpeg. I use 2-4 to put it on a dvd for later viewing.

    1) Convert any file format (including flv) to mpeg4 format
    ffmpeg -i video.avi -target ntsc-dvd -aspect 4:3 output.mpg

    2) Convert mpeg4 to dvd format with 15 minute chapters
    dvdauthor -o dvd.movie -t -c 0,15:00,30:00,45:00,1:00:00,1:15:00,1:30:00,1:45:00 output.mpg

    3) Close out the dvdproject
    dvdauthor -o dvd.movie/ -T

    4) Burn to dvd media with k3b

    I’ll have to look into the streaming aspects of ffmpeg. Currently using vlc from the command line to perform this and works pretty darn good.

  21. ?????? says:

    Thank you very much ,,

  22. GagetPig says:

    There is a front end to ffmpeg that makes this easier.

    http://code.google.com/p/winff/

  23. guest says:

    Why not use vlc player to convert: open file->advanced alternatives: ettings->chose file and /home/you/vlcoutput.mpeg–>mark videocodec and soundcodec (leave default settings i you want) and then just hit OK twice.
    sit back and whait for a wild and the convertion is finished 🙂
    Kind Regards \\m

  24. Sebastian says:

    For reference:
    With a 13 meg flv input file.
    ffmpeg -i jokes.flv -ab 56 -ar 22050 -b 500 -s 320×240 jokes.mpg results in a 13 meg file that losses a LOT of quality. (BTW, my version of ffmpeg complains on the b parameter. “WARNING: The bitrate parameter is set too low. It takes bits/s as argument, not kbits/s” it should probably be 16)

    /usr/bin/ffmpeg -i “/home/me/film.flv” -target ntsc-dvd -r 29.97 -s 720×480 -aspect 4:3 -b 8000k -mbd rd -flags +trell -mv0 -cmp -subcmp 2 “/home/me/film.mpg” results in a 184M file. (although the quality was almost BETTER than the flv which is kinda unexplainable) (note, I had to remove -flags +trell on windows because the windows binary of ffmpeg didn’t support the -flags parameter)

    Using vlc media player’s stream output option was quicker and resulted in a 45M file that was pretty much an exact copy of the original.

    Might be useful to someone else to know before hand. Thanks to all for there multiple methods skinning said cat.

  25. heru h day says:

    i have a error message after convert my flv video to mpg ..
    anybody can help me??

    [email protected]:/media/data_/baru_/Downloads/Video# ffmpeg -i 40745412.flv -b 39 -ab 22050 -b 500 -s 160×120 jokes.mpg
    FFmpeg version r11872+debian_3:0.svn20080206-12ubuntu3, Copyright (c) 2000-2008 Fabrice Bellard, et al.
    configuration: –enable-gpl –enable-pp –enable-swscaler –enable-x11grab –prefix=/usr –enable-libgsm –enable-libtheora –enable-libvorbis –enable-pthreads –disable-strip –enable-libfaad –enable-libfaadbin –enable-liba52 –enable-liba52bin –enable-libdc1394 –disable-armv5te –disable-armv6 –disable-altivec –disable-vis –enable-shared –disable-static
    libavutil version: 49.6.0
    libavcodec version: 51.50.0
    libavformat version: 52.7.0
    libavdevice version: 52.0.0
    built on Oct 3 2008 22:40:31, gcc: 4.3.2

    Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 15.00 (15/1)
    Input #0, flv, from ‘40745412.flv’:
    Duration: 10:04:46.5, start: 1320.000000, bitrate: 39 kb/s
    Stream #0.0: Video: flv, yuv420p, 160×120 [PAR 0:1 DAR 0:1], 15.00 tb(r)
    Stream #0.1: Audio: mp3, 22050 Hz, stereo, 40 kb/s
    WARNING: The bitrate parameter is set too low. It takes bits/s as argument, not kbits/s
    WARNING: The bitrate parameter is set too low. It takes bits/s as argument, not kbits/s
    File ‘jokes.mpg’ already exists. Overwrite ? [y/N] y
    Output #0, mpeg, to ‘jokes.mpg’:
    Stream #0.0: Video: mpeg1video, yuv420p, 160×120 [PAR 0:1 DAR 0:1], q=2-31, 0 kb/s, 15.00 tb(c)
    Stream #0.1: Audio: mp2, 22050 Hz, stereo, 22 kb/s
    Stream mapping:
    Stream #0.0 -> #0.0
    Stream #0.1 -> #0.1
    [mpeg1video @ 0xb7d5a2f0]MPEG1/2 does not support 15/1 fps
    Error while opening codec for output stream #0.0 – maybe incorrect parameters such as bit_rate, rate, width or height

  26. I somehow can’t convert those damn new 16:9 FLVs youtube uses now….damn them….(-;

  27. Jessica :) says:

    Hi!

    Just an FYI, -b and -ab set the bitrate by bytes per second, not kb. Therefore multiply the supplied values by 1024.

    I noticed somebody above got the same error. The easiest fix is the delete the settings supplied above and use the defaults.

  28. Nishad Aliyar says:

    I need to get the video in the same quality of input file after video conversion and the size of the converted file near or same to the input file.
    Can anyone help me please?, I lost more time in this.

    This is the code I used for conversion
    exec(“../ffmpeg -i 1.mov -sameq -f flv -vcodec flv -b 400kb -s 614×400 -qmin 1 -qmax 31 -acodec libmp3lame -ar 22050 -ac 1 1.flv”);

    After conversion quality of the video is ok, but the size of the flv file (1.flv) converted is large in size.
    If I remove the -sameq from the above syntax , problem of huge size of converted flv file
    (1.flv) will solve , then the quality of the video is poor.

Leave a Reply

Your email address will not be published.