How to Wrap h264 rawdata in MP4 Container format(For live Streaming)

1,128 views
Skip to first unread message

Dhaval sanghvi

unread,
Mar 29, 2010, 7:29:10 AM3/29/10
to C++ RTMP Server
Hi, I m new in this streaming project,please guide me. I have stuck
with streaming stuff.........i have h264 raw data but i dont know how
can i wrap it with MP4 container format.I m waiting for your
reply.Then i want to stream that mp4 stream.

Thanks....

C++ RTMP Server

unread,
Mar 29, 2010, 6:40:05 PM3/29/10
to c-rtmp...@googlegroups.com

If you are talking about NALU stream, that is already implemented. After you run the server, you should see a table containing the list of services. The one that you are interested in is naluProtocol

As for the converting the NALU stream itself into a mp4 container, I think there are more better suited tools like (ffmepg for example)

Cheers,
Andrei

>
> Thanks....
>
> You received this message because you are subscribed to "C++ RTMP Server" mailing list.
> To post to this group, send email to c-rtmp...@googlegroups.com
> To unsubscribe from this group, send email to
> c-rtmp-serve...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/c-rtmp-server?hl=en
>
> To unsubscribe from this group, send email to c-rtmp-server+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

Theo

unread,
Mar 30, 2010, 12:57:08 AM3/30/10
to c-rtmp...@googlegroups.com
Dhaval,

I've been down this same path myself.

The MP4 container format typically has hint information in it that allows for quick seeking to a time position in the file.  While this is convenient when playing a file, it makes streaming live data impossible.

The MP4 container spec (defined in ISO/IEC 14496-12) would appear to be flexible enough to support streamding, but I've never found any tools that will package the data in a streaming capable format.

There are some MP4 streaming (or pseudo-streaming) implementations that will find the hint information in the file and move it to the beginning of the stream (rtmpd does this when streaming MP4 files), but once again, this only works when the streaming source is a file.  Live data would not have the hint data.  The hint data typically gets written when the file is closed.

After searching down this same path, I am going to be using the NALU format for a my live streaming implementation.

Your raw H264 data is probably already in the NALU format.  You can find the spec for that format (also called MP4 Annex B or byte stream format) in Annex B of ISO/IEC 14496-12 where the MP4 base media file format is defined.

As Andrei mentioned, the NALU format is already implemented.  A fixed frame rate version is implemented as an example by the naluapp.

Theo
Reply all
Reply to author
Forward
0 new messages