Friendship is like standing on wet cement. The longer you stay, the harder it's to leave, and you can never go without leaving your footprints behind.

Ubuntu howto: converting .FLV to MPG

sudo apt-get install ffmpeg
ffmpeg -i video.flv -ab 56 -ar 22050 -b 500 -s 320x240 video.mpg

finally to make your life easier just put it a script file to excute later

mkdir ~/scripts;
echo 'ffmpeg -i $1 -ab 56 -ar 22050 -b 500 -s 320x240 $1.mpg' > f2mpg.sh;
mv Flv2Mpg.sh ~/scripts

now whenever you want to convert FLV file to mpg just shot the

 ~/scripts/f2mpg.sh Flv_video_file_name.flv

for further information check

man ffmpeg
Web 2.0 live on alms! share it & you will be answered one day
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • E-mail this story to a friend!
  • Identi.ca
  • LinkedIn
  • Netvibes
  • StumbleUpon
  • TailRank
  • Technorati
  • TwitThis
Related Websites

No Responses to “Ubuntu howto: converting .FLV to MPG”

  1. Rodnei Says:

    Hey, thanks very much for this tip!!!

  2. faizal Says:

    just what i need for converting files for my ppc. 10q man

  3. d Says:

    gr8, never thought this was possible.

  4. Moyea Says:

    You can convert flv to mpeg easily useing Moyea Flash to Video Converter on windows.

  5. Me Says:

    I only get
    [flv @ 0x82c5740]Unsupported video codec (4)

    So, is there anyway to
    a) adjust your solution
    b) use another converting solution
    c) get totem, vlc or mplayer to play the file
    d) get another player to play the file

    all solutions must be for Linux of course, preferably Ubuntu…

  6. Jad Says:

    Can you give yourself a name? and please paste the error here.
    maybe you should follow the instructions here.
    https://help.ubuntu.com/community/RestrictedFormats

  7. Larsson Says:

    Me = Larsson

    When I run f2mpg.sh I get
    >~/scripts/f2mpg.sh file.flv
    ffmpeg version CVS, build 3276800, Copyright (c) 2000-2004 Fabrice Bellard
    configuration: –build i486-linux-gnu –enable-gpl –enable-pp –enable-zlib –enable-vorbis –enable-libogg –enable-theora –enable-a52 –enable-dts –enable-dc1394 –enable-libgsm –disable-debug –prefix=/usr
    built on Sep 29 2005 03:25:16, gcc: 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu8)
    [flv @ 0x82c5740]Unsupported video codec (4)
    [flv @ 0x82c5740]Unsupported video codec (4)
    [flv @ 0x82c5740]Unsupported video codec (4)
    [flv @ 0x82c5740]Unsupported video codec (4)
    [flv @ 0x82c5740]Unsupported video codec (4)
    [flv @ 0x82c5740]Unsupported video codec (4)
    [flv @ 0x82c5740]Unsupported video codec (4)
    [flv @ 0x82c5740]Unsupported video codec (4)
    [flv @ 0x82c5740]Unsupported video codec (4)
    [flv @ 0x82c5740]Unsupported video codec (4)
    [flv @ 0x82c5740]Unsupported video codec (4)
    [flv @ 0x82c5740]Unsupported video codec (4)
    [flv @ 0x82c5740]Unsupported video codec (4)

  8. Jad Says:

    Larsson,
    Weird, it should work; anyway please try

     file video.flv 

    it should return

    video.flv: Macromedia Flash Video

    else it would be a different video format with incorrect .FLV extension

    actually I just tried to install ffmpeg on new ubuntu installation and I
    just had to install

    ffmpeg libdc1394-13 libimlib2

    and it worked just fine

    ffmpeg -i video.flv -ab 56 -ar 22050 -b 500 -s 320x240 vide o.mpg
    ffmpeg version CVS, build 3276800, Copyright (c) 2000-2004 Fabrice Bellard
    configuration: --extra-cflags=-fomit-frame-pointer -DRUNTIME_CPUDETECT
    --buil d i486-linux-gnu --enable-gpl --enable-pp --enable-zlib
    --enable-vorbis
    --enable -libogg --enable-theora --enable-a52 --enable-dts --enable-dc1394
    --enable-libgs m --disable-debug --prefix=/usr
    built on Nov 24 2005 10:19:02, gcc: 4.0.3 20051121 (prerelease)
    (Ubuntu 4.0.2- 4ubuntu3)
    Seems that stream 1 comes from film source: 1000.00 (1000/1) -> 30.00 (30/1)
    Input #0, flv, from 'video.flv':
    Duration: N/A, bitrate: N/A
    Stream #0.0: Audio: mp3, 22050 Hz, mono
    Stream #0.1: Video: flv, yuv420p, 320x239, 1000.00 fps
    Output #0, mpeg, to 'video.mpg':
    Stream #0.0: Video: mpeg1video, yuv420p, 320x240, 30.00 fps, q=2-31, 500 kb/s
    Stream #0.1: Audio: mp2, 22050 Hz, mono, 56 kb/s
    Stream mapping:
    Stream #0.1 -> #0.0
    Stream #0.0 -> #0.1
    Press [q] to stop encoding
    frame= 922 q=0.0 Lsize= 2298kB time=30.5 bitrate= 617.0kbits/s
    video:2062kB audio:209kB global headers:0kB muxing overhead 1.213712%
    

    so finally if the file video.flv return a correct macromedia format then the solution would be beyond my experience how ever I’ll try to digg for a solution

  9. Link With Reality Web Log » links for 2006-07-06 Says:

    [...] Ubuntu howto: converting .FLV to MPG Quick tutorial on converting FLV files to MPG. (tags: howto video linux) Links :: John :: [...]

  10. Jade Says:

    Hello,
    When I have tried to do this, I get this error string in root usr:

    root@jadesworld:/home/jadester# ffmpeg – vido.flv -ab 56 -ar 22050 -b 500 -s 320 x240 video.mpg
    ffmpeg version CVS, build 3276800, Copyright (c) 2000-2004 Fabrice Bellard
    configuration: –extra-cflags=-fomit-frame-pointer -DRUNTIME_CPUDETECT –buil d i486-linux-gnu –enable-gpl –enable-pp –enable-zlib –enable-vorbis –enable -libogg –enable-theora –enable-a52 –enable-dts –enable-dc1394 –enable-libgs m –disable-debug –prefix=/usr
    built on Nov 24 2005 10:19:02, gcc: 4.0.3 20051121 (prerelease) (Ubuntu 4.0.2- 4ubuntu3)
    Unable for find a suitable output format for ‘pipe:’

    So I cannot convert flv files to mpg files. Help if you can. If you can’t I totally understand.
    Any other info you may need pls ask. Thanks and Cheers!
    Jade

  11. Quicksilver_Johny Says:

    On Xubuntu: with ffmpeg, libdc1394-13, and libimlib2:

    ffmpeg -i video.flv -ab 56 -ar 22050 -b 500 -s 320×240 video.mpg
    ffmpeg version CVS, build 3276800, Copyright (c) 2000-2004 Fabrice Bellard
    configuration: –extra-cflags=-fomit-frame-pointer -DRUNTIME_CPUDETECT –build i486-linux-gnu –enable-gpl –enable-pp –enable-zlib –enable-vorbis –enable-libogg –enable-theora –enable-a52 –enable-dts –enable-dc1394 –enable-libgsm –disable-debug –prefix=/usr
    built on Nov 24 2005 10:19:02, gcc: 4.0.3 20051121 (prerelease) (Ubuntu 4.0.2-4ubuntu3)
    [flv @ 0x82c8200]Unsupported video codec (3)
    [flv @ 0x82c8200]Unsupported video codec (3)
    [flv @ 0x82c8200]Unsupported video codec (3)
    [flv @ 0x82c8200]Unsupported video codec (3)
    [flv @ 0x82c8200]Unsupported video codec (3)
    [flv @ 0x82c8200]Unsupported video codec (3)
    [flv @ 0x82c8200]Unsupported video codec (3)
    [flv @ 0x82c8200]Unsupported video codec (3)
    [flv @ 0x82c8200]Unsupported video codec (3)
    [flv @ 0x82c8200]Unsupported video codec (3)
    [flv @ 0x82c8200]Unsupported video codec (3)
    [flv @ 0x82c8200]Unsupported video codec (3)
    [flv @ 0x82c8200]Unsupported video codec (3)
    video.flv: could not find codec parameters

  12. Jad Says:

    Jade,
    I’m not that expert but I found similar problem and solution at ffmpeg-user mailing list the guy had similar problem and they helped him to get it solved.

    Quicksilver_Johny,
    First go through this guide
    if it didn’t work after installing the restricted format then it’s not supported :(

  13. Terminally Incoherent » Blog Archive » Saving YouTube Movies Says:

    [...] Sources: gillsmethod and jadmadi. tags: flv, youtube, saving youtube video, flv player, media coder, mplayer, ffmpeg [...]

  14. burnick Says:

    do u know how to convert mpg videos to 3gp? using ffmpeg

  15. Roy Says:

    Here’s a small tweak for your script that cleans up the final filename a little:

    #!/bin/bash
    OLD=$1
    NEW=`basename $OLD .flv`
    ffmpeg -i $OLD -ab 56 -ar 22050 -b 500 -s 320×240 $NEW.mpg

  16. Dave Says:

    Great work fella! Combine this with the firefox extension and you’re laughing!
    http://javimoya.com/blog/youtube_en.php

  17. HorusLee Says:

    Error:
    “mv Flv2Mpg.sh ~/scripts”
    should be
    “mv f2mpg.sh ~/scripts”
    right?

  18. HorusLee Says:

    [mpeg1video @ 0x8336308]warning, clipping 1 dct coefficients to -255..255
    [mpeg1video @ 0x8336308]warning, clipping 1 dct coefficients to -255..255
    [mpeg1video @ 0x8336308]warning, clipping 1 dct coefficients to -255..255
    [mpeg1video @ 0x8336308]warning, clipping 1 dct coefficients to -255..255
    [mpeg1video @ 0x8336308]warning, clipping 1 dct coefficients to -255..255
    [mpeg1video @ 0x8336308]warning, clipping 1 dct coefficients to -255..255
    [mpeg1video @ 0x8336308]warning, clipping 1 dct coefficients to -255..255

    Why this happened?

  19. Jad Says:

    hmm, well I don’t know but I’ll go through the documentations again and see if I can come up with a script that convert and give explanation when there is a problem.

  20. links for 2006-09-02 « Where Is All This Leading To? Says:

    [...] Ubuntu howto: converting .FLV to MPG (tags: flash howto kubuntu linux ubuntu video flv multimedia convert mpg) [...]

  21. The Shout of Horus Lee Says:

    Ubuntu howto: converting .FLV to MPG by Jad…

    Ubuntu howto: converting .FLV to MPG by Jad…

  22. inan Says:

    Excellent!! That’s exactly what i want…
    thnx.

  23. bijan Says:

    Hey Jad, thanks for the cool tip, but after running the command, I get the following error:

    bijan@romanticFart:~$ ffmpeg -i MyDownloads/get_video.flv -ab 56 -ar 22050 -b 500 -s 320×240 oopse.mpg
    ffmpeg version CVS, build 3276800, Copyright (c) 2000-2004 Fabrice Bellard
    configuration: –extra-cflags=-fomit-frame-pointer -DRUNTIME_CPUDETECT –build i486-linux-gnu –enable-gpl –enable-pp –enable-zlib –enable-vorbis –enable-libogg –enable-theora –enable-a52 –enable-dts –enable-dc1394 –enable-libgsm –disable-debug –prefix=/usr
    built on Nov 24 2005 10:19:02, gcc: 4.0.3 20051121 (prerelease) (Ubuntu 4.0.2-4ubuntu3)

    Seems that stream 1 comes from film source: 1000.00 (1000/1) -> 15.00 (15/1)
    Input #0, flv, from ‘MyDownloads/get_video.flv’:
    Duration: N/A, bitrate: N/A
    Stream #0.0: Audio: mp3, 22050 Hz, mono
    Stream #0.1: Video: flv, yuv420p, 320×240, 1000.00 fps
    Output #0, mpeg, to ‘oopse.mpg’:
    Stream #0.0: Video: mpeg1video, yuv420p, 320×240, 15.00 fps, q=2-31, 500 kb/s
    Stream #0.1: Audio: mp2, 22050 Hz, mono, 56 kb/s
    Stream mapping:
    Stream #0.1 -> #0.0
    Stream #0.0 -> #0.1
    [mpeg1video @ 0x8336308]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

    Well, I have no idea what I should give for those parameters, any tips?

  24. bdogg64 Says:

    You may need to update your version of ffmpeg. I compile ffmpeg from source on ubuntu every so often. I use ffmpeg to convert youtube and google flash videos from to 3gp and mp4 clips on MyMobileClips

  25. Dusty Rancourt Says:

    This is marvelous, thank you. One suggestion, if I may, though — your script as-is fails on file names with spaces. A small modification fixes this:

    echo ‘ffmpeg -i “$1″ -ab 56 -ar 22050 -b 500 -s 320×240 “$1.mpg”‘ > f2mpg.sh

    Thank you so much for this excellent solution. I am most grateful!

  26. linux enthusiast Says:

    here is my conversion script you can only do one video at a time
    the flv converts to mpg and keeps the original file name.

    #!/bin/bash

    output=`ls *.flv -1|cut -f1 -d”.”`
    ffmpeg -i *.flv -ab 56 -ar 22050 -b 500 -s 320×240 $output.mpg
    rm *.flv
    exit

  27. linux enthusiast Says:

    also you can only have one flv in the folder at a time
    you should put the script in /usr/bin make a folder just for converting video put a shortcut to the script(inside the folder) that runs in the terminal drag one flv into the folder and click your shortcut
    voila you have an mpg and the flv gets deleted. sorry for 2 post just wanted to make it easy on someone else.Took a while to get this right i’m not a bash expert.

  28. Jake Says:

    Why not simply add a command to your .bashrc instead of making a script?

  29. John Says:


    dice@ZepplinIV:~$ ffmpeg -i video.flv -ab 56 -ar 22050 -b 500 -s 320x240 video.mpg
    FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
    configuration: --enable-gpl --enable-pp --enable-pthreads --enable-vorbis --enable-libogg --enable-a52 --enable-dts --enable-libgsm --enable-dc1394 --disable-debug --enable-shared --prefix=/usr
    libavutil version: 0d.49.0.0
    libavcodec version: 0d.51.11.0
    libavformat version: 0d.50.5.0
    built on Jan 28 2007 22:48:38, gcc: 4.1.2 20070106 (prerelease) (Ubuntu 4.1.1-21ubuntu7)
    video.flv: I/O error occured
    Usually that means that input file is truncated and/or corrupted

    I’m pretty new to linux, however I’m pretty sure the video works, because I can play it in windows on divX. Do you know if there would be any problem?
    P.S. I’m using Feisty, but I figured it wouldn’t be a problem.

  30. Jad Says:

    John
    I’d recommend using PyTube

    sudo aptitude install pytube

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>