FLV encoding with ffmpeg 15

Posted by Antonin AMAND Mon, 25 Sep 2006 17:22:00 GMT

ffmeg is a command-line tool for video encoding which has the ability to encode videos in FLV format (Macromedia plugin for direct-streaming).

First, you need to install ffmpeg with liblame support.

You may grab it as package or compile from sources.

We will compile from sources in this article for more compatibility.

first step : Installing lame get sources at http://lame.sourceforge.net, untar the archive and chdir to unpacked sources directory.

$ ./configure && make && sudo make install

second step : Installing ffmpeg

Getting sources from svn :

 $ svn export svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

Change dir to ffmpeg and compile with liblame

$ ./configure --enable-mp3lame && make && sudo make install

Your now setup. You can continue with encoding your first video

$ /usr/local/bin/ffmpeg  -i input.mov -ar 22050 -ab 56 -aspect 4:3 \
 -b 200 -r 12 -f flv -s 320x240 -acodec mp3 -ac 1 output.flv

to view the result download a swf FLV player and create a html file :

<html>
<head>
<title>Flash FLV Player</title>
</head>
<body>
<h3>My First FLV video</h3>
<object type="application/x-shockwave-flash" width="320" height="260" wmode="transparent" data="flvplayer.swf?file=output.flv&amp;autoStart=false">
<param name="movie" value="flvplayer.swf?file=output.flv&amp;autoStart=false" />
<param name="wmode" value="transparent" />
</object>

</body>
</html>

Enjoy !

Trackbacks

Use the following link to trackback from your own site:
http://blog.gwikzone.org/trackbacks?article_id=flv-encoding-with-ffmpeg&day=25&month=09&year=2006

Comments

Leave a comment

  1. gobba about 1 year later:

    Nice guide.

    How do i do this through php? Do i have to use the CLI from php? I want users to upload their videos and then to show em on the homepage as flvs autoamgically. Do you know how?

    Plz mail answer. =)

    -gob

  2. bennyZen about 1 year later:

    first of all: thx for the article.

    just to point out a little mistake - this line

    $ ./configure --enable-mp3lame && make && sudo make install

    should read something like ...

    $ ./configure --enable-libmp3lame && make && sudo make install

    to work properly.

  3. bülent about 1 year later:

    zamanla anlaşılır hale gelir

  4. Mietshop about 1 year later:

    Seems stream 1 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 25.00 (25/1) Input #0, asf, from 't.wmv': Duration: 00:01:52.3, start: 3.000000, bitrate: 555 kb/s Stream #0.0: Audio: wmav2, 44100 Hz, stereo, 96 kb/s Stream #0.1: Video: wmv3, yuv420p, 384x288, 25.00 fps(r) File '_tonnendeko.de.flv' already exists. Overwrite ? [y/N] y Output #0, flv, to 't.flv': Stream #0.0: Video: flv, yuv420p, 384x288, q=2-31, 500 kb/s, 25.00 fps(c) Stream #0.1: Audio: 0x0000, 44100 Hz, mono, 64 kb/s Stream mapping: Stream #0.1 -> #0.0 Stream #0.0 -> #0.1 Unsupported codec for output stream #0.1

    The audio codec seem's to have a problem, but why?

  5. Jill about 1 year later:

    hey, thanks so much for posting this. it really helped me. so much. :D

  6. Leon about 1 year later:

    I got this error:

    Output #0, flv, to './tmp.flv': Stream #0.0: Video: flv, yuv420p, 400x320, q=2-31, 0 kb/s, 25.00 fps(c) Stream #0.1: Audio: 0x0000, 22050 Hz, stereo, 0 kb/s Stream mapping: Stream #0.0 -> #0.0 Stream #0.1 -> #0.1 Unsupported codec for output stream #0.1

  7. aurelien about 1 year later:

    debian prevent use of liblame by default, probably. recompile ffmpeg with liblame support.

  8. vkrishn about 1 year later:

    [imgconvert @ 0x98f6030]PIXFMTYUV420P will be used as an intermediate format for rescaling Output #0, flv, to 'bird.flv': Stream #0.0: Video: flv, yuv420p, 320x240 [PAR 1:1 DAR 4:3], q=2-31, 0 kb/s, 12.00 tb(c) Stream mapping: Stream #0.0 -> #0.0 Unsupported codec (id=115) for input stream #0.0

  9. vkrishn about 1 year later:

    I got this error! (fedora 8)

    [imgconvert @ 0x98f6030]PIXFMTYUV420P will be used as an intermediate format for rescaling Output #0, flv, to 'bird.flv': Stream #0.0: Video: flv, yuv420p, 320x240 [PAR 1:1 DAR 4:3], q=2-31, 0 kb/s, 12.00 tb(c) Stream mapping: Stream #0.0 -> #0.0 Unsupported codec (id=115) for input stream #0.0

  10. vkrishn about 1 year later:

    I got this error! (fedora 8)

    [imgconvert @ 0x98f6030]PIXFMTYUV420P will be used as an intermediate format for rescaling Output #0, flv, to 'bird.flv': Stream #0.0: Video: flv, yuv420p, 320x240 [PAR 1:1 DAR 4:3], q=2-31, 0 kb/s, 12.00 tb(c) Stream mapping: Stream #0.0 -> #0.0 Unsupported codec (id=115) for input stream #0.0

  11. izero about 1 year later:

    It is simple ... try using FFlib.NET from http://www.intuitive.sk/fflib/

  12. izero about 1 year later:

    It is simple ... try using FFlib.NET from http://www.intuitive.sk/fflib/

  13. izero about 1 year later:

    It is simple ... try using FFlib.NET from http://www.intuitive.sk/fflib/

  14. Eric over 2 years later:

    You may also need to specify the path to libmp3lame: export LD_PRELOAD = /usr/local/lib/libmp3lame.so.0

  15. vladio over 2 years later:

    this works fine, thx a lot!!!

Comments