[FFmpeg-devel] questions on live streaming of h.264 in a FLV container

Daniel G. Taylor dan
Wed Sep 3 22:30:57 CEST 2008

On Wed, 2008-09-03 at 12:36 -0700, Raymond Peck wrote:
> Hey there!
> We have a system which streams live video which is encoded into an FLV
> container using ffmpeg.  Playback is through a Flash player.  The
> streaming server ensures that the player gets data which begins on a
> keyframe (not necessarily on an IDR frame. . .) by throwing away video
> stream data until it sees a keyframe.
> I'm trying to get it to work with libx264 instead of the other codec.
> When I start the player so that it's listening to an empty pipe, and
> then start the video stream, the player plays the x264/FLV video just
> fine.  This is very encouraging.
> However, when the player comes in in the middle of the steam I get no
> video.  I'd love to hear any clues that anyone might have, especially
> if they have a similar system running.  :-)

I stream H.264/AAC in MP4 that's created using libx264 to Flash. Flash
support for MP4 is okay, not great. When not using Flash Media Server it
requires all the metadata for the file to be in a moov atom at the
beginning of the file (no support for moof/traf atoms scattered in the
file). Streaming works using a module in the web server that modifies
the moov atom and truncates the mdat atom to remove video before the
position in the file that was seeked to. In practice this modification
is very fast. The module is mod_h264_streaming for lighttpd, but the
code is fairly simple.

Basically this means you must send ftyp and modified moov atoms for
every seek, then the raw data at that position in the file (the mdat

As for real streaming, I have no idea how the proprietary RTMP protocol
works, and I'm not sure about H.264 in FLV (I believe Adobe recommends
using MP4 or F4V, a modification of MP4, and recommends against using

> * snip *

Take care,
Daniel G. Taylor

More information about the ffmpeg-devel mailing list