[Live-devel] Need help: RTSP Stream -> video render

Barry Stump bstump at codemass.com
Mon Feb 27 17:11:19 PST 2012


For H.264, the payload delivered in the afterGettingFrame() method is a NAL
unit.  The big ones are (usually) the coded video frames (there are various
types depending on your encoder settings) and the small ones are (usually)
SPS and PPS NAL units which contain various settings needed by your
decoder.  You can read up on all the technical details in RFC 3984:
http://tools.ietf.org/html/rfc3984

My particular hardware encoder device sends NAL units in the following
order: 7, 8, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 8, 5, ... The 5 and the 1's
are actual frame data, the 7's and 8's are SPS/PPS units.  All that is
necessary for me to decode these in FFmpeg is to prepend the 4 bytes
0x00000001 to each NAL unit, bundle each one up in a AVPacket struct, and
hand it off to FFmpeg's avcodec_decode_video2() function.

-Barry

On Mon, Feb 27, 2012 at 3:25 PM, Brad O'Hearne <brado at bighillsoftware.com>wrote:

> Barry,
>
> Thank you very much for your reply. What you have spoken to here is
> exactly the model that I have followed, but the crux of the issue I am
> trying to solve involves exactly what you are touching on. In short what I
> have is:
>
> H.264 video -> RTSP -> RTSPClient -> MediaSink subclass
>
> exactly as you have described. My present challenge is properly grabbing
> the received data in the afterGettingFrame() function, and feeding to the
> ffmpeg avcodec. Specifically, I am trying to make sure that the data
> received from Live555 and handed to ffmpeg is the proper format and
> quantity. In other words, the ffmpeg avcodec is seeking a packet (or more
> properly put, an "AVPacket" according to their parlance. I know this isn't
> an ffmpeg discussion list, so my purpose isn't to discuss ffmpeg, but I do
> need to gather and construct (if necessary) the received data to construct
> this packet.
>
> My questions are:
>
> 1. Is such a packet the payload within the afterGettingFrame() function,
> and if so, how do I grab it?
>
> 2. If the answer to 1 is no, then I need some any pointers on how to
> construct it.
>
> I do indeed currently have adapted code similar to the testRTSPClient
> example and can receive RTSP data successfully. However, what I'm seeing is
> that when the afterGettingFrame() function is getting called, I am seeing a
> cycle of data received....2 calls with a 9 and 5 bytes respectively,
> followed by the receipt of about 23K+/- of data. (see the attached log). I
> am suspecting that these aren't all full packets.
>
> Any insight you can give would be greatly appreciated, thx!
>
> Brad
>
> Brad O'Hearne
> Founder / Lead Developer
> Big Hill Software LLC
> http://www.bighillsoftware.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20120227/091a3c42/attachment.html>


More information about the live-devel mailing list