Help with RTP fragmentation encoding (FU-A) packets
I have a stream source which provides me H264 NAL units. I'm writing an Android app that first compiles individual NAL units into a Complete Access Unit and then runs this entire packet through the Android MediaCodec for display. I take this same packet and attempt to create RTP packets to send to Wowza using RTSP/RTP.
I originally misread the RTP spec and instead send individual NAL units (not complete access units) to Wowza, which is didn't like very much. Using FFMpeg for testing, I was able to encode a complete access unit using single NAL unit mode (RTP) and display a proper test video using FFPlay. I am processing HD video, so I need to packetize the NAL units using fragmentation in order to fit the data inside the UDP MTU limit size. So, I turned my attention to RTP non-interleave mode and the FU-A fragmentation scheme. Using FFMpeg again for testing, I am able to receive and play RTP fragmented packets in FFplay properly.
Wowza does not like my packetization. Not only will it not play in the test players, but it will not record the stream either. When I used the Single NAL Unit mode, Wowza would not display the video but would at least record it (although only about 1/3rd of the video looked proper because of overwhelming the UDP MTU size). Using FU-A fragmentation, Wowza will not record anything.
This leads me to believe my packetization scheme may not be correct. Below is a sample of my log file output. According to the flags, this should compose a complete access unit.
SO, can anyone tell me if this log file looks normal? Also, am I correct in assuming that Wowza will not record nor play any stream that it can't decode properly? Am I also correct in assuming FFMpeg is more robust in its decoding since it can play my stream fine? I don't see any sort of error in the log file about not being able to decode, play, record ... nothing.
I determined what the problem was. My packetization was incorrect - in case anyone ever searches for this (tech support did not understand what was wrong).
RTP to Wowza needs to encapsulate each individual NAL unit, not a complete access unit. However, it's very sensitive to timestamps. All of the individual NAL units that compose the complete access unit must have different sequence numbers (incrementing) but the same RTP packet timestamp. I'm guessing this is how Wowza knows they came from the same access unit. The same rule applies for fragmented packets inside a complete NAL unit. Increment the sequence, maintain the timestamp.