[Live-devel] The way to muxing H264 and AAC RTP into a MPEG Transport stream

James Huang seamxr at gmail.com
Fri Aug 29 15:11:12 PDT 2014


Hi,


After weeks of time spent, now my module finally can muxing H264 and AAC
RTP streams into a MPEG-TS. Here write down the "big picture" for someone
new at this onto the track quickly.


Objective: Create a relay program which works as a RTSP client, consumes
the video and audio RTP sessions, muxing them into a MPEG-TS and then push
to somewhere network you need.

To-do:
1. The implementation can start on the testRTSPCclient

2. For incoming H264 RTP session, firstly, you will need to implement a
filter class to insert H264 Start code in the beginning of each frame. The
work will simply insert 4 bytes (0x00, 0x00, 0x00, 0x01) in the beginning
of each frame.

3. For incoming AAC RTP session, firstly, you will need to implement a
filter class to insert ADTS header in front of each AAC packet. ADTS header
just several bytes and the format can be find on internet easily, mostly
bit-wise operations according to your environment.

4. In the continueAfterSETUP(), feed the video session's FrameSource (this
will be a H264VideoRTPSource) into your H264 StartCode filter, and then
feed the H264 StartCode filter into a MPEG2TransportStreamFromESSource by
it's addNewVideoSource, use 5 as the mpegVersion.

5. In the continueAfterSETUP(), feed the audio session's FrameSource (this
will be a MPEG4GeneticRTPSource) into your ADTS header filter, and then
feed the ADTS header filter into the same MPEG2TransportStreamFromESSource
by it's addNewAudioSource, use 4 as the mpegVersion.

6. After the 2 session setup completed, call startPlaying of a
SimpleRTPSink with the MPEG2TransportStreamFromESSource.


Hope this helps.
James.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20140829/732a49fb/attachment-0001.html>


More information about the live-devel mailing list