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: <a href="http://tools.ietf.org/html/rfc3984">http://tools.ietf.org/html/rfc3984</a><div>
<br></div><div>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.</div>
<div><br></div><div>-Barry</div><div><br><div class="gmail_quote">On Mon, Feb 27, 2012 at 3:25 PM, Brad O'Hearne <span dir="ltr"><<a href="mailto:brado@bighillsoftware.com">brado@bighillsoftware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Barry, <div><br></div><div>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: </div>
<div><br></div><div>H.264 video -> RTSP -> RTSPClient -> MediaSink subclass</div><div><br></div><div>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. </div>
<div><br></div><div>My questions are: </div><div><br></div><div>1. Is such a packet the payload within the afterGettingFrame() function, and if so, how do I grab it? </div><div><br></div><div>2. If the answer to 1 is no, then I need some any pointers on how to construct it. </div>
<div><br></div><div>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. </div>
<div><br></div><div>Any insight you can give would be greatly appreciated, thx!</div><div><br></div><div><div>
<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">
<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Helvetica;word-spacing:0px"><div style="word-wrap:break-word">
Brad<span class="HOEnZb"><font color="#888888"><br><br>Brad O'Hearne<br>Founder / Lead Developer<br>Big Hill Software LLC<br><a href="http://www.bighillsoftware.com" target="_blank">http://www.bighillsoftware.com</a></font></span></div>
</span></div></span></span>
</div><div><br></div>
</div></div></blockquote></div><br></div>