<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div>Security cameras keep it simple. They will not usually have bidirectionally predictive frames as that generally takes a two pass encoder and adds latency. Either way that is not the concern at the streaming level although i think live555 will reorder frames if need be.<br><br></div><div>Remember that this is an RTSP stream, probably unlike the MJPEG you are use to. <br></div><div>Wikipedia has a good explanation of the basic RTSP conversation. Live555 implements this protocol (both as server and as client)<br><br></div><div>Look at the RTSPCLient.cpp and PlayCommon.cpp to understand the client.<br></div>After the necessary steps to start up the conversation with the response from each step responsable for sending the next one.<br><br></div>OPTIONS<br></div>DESCRIBE<br></div>SETUP<br>PLAY<br><br></div> You will call GetNextFrame and live555 will listen the on the socket, collect the data into frames, handle all the lower level protocol assemble into and pass only only complete nal units to your afterGettingFunction, Complete with presentation timestamps.<br><br></div>At that point you need to collect the frames into your buffer for decoding and display. And call GetNextFrame to keep everything moving.<br><br></div><div>Oversimplified...<br><br></div><div>class GOP<br></div><div>{<br></div><div>public:<br></div><div> uint8* m_keyFrame<br></div><div> uint8* [] m_diffFrames<br></div><div> int framecount<br><br></div><div> ~GOP(){ // delete all allocated buffers}<br></div><div> <br>} <br></div><div><br></div>So lets say you have a simple producer consumer ring buffer holding pointers to GOP instances.<br><br></div>You maintain a statemachine watching the transitions of nal unit types and fill in the GOP's with the bytes for each frame.<br></div>Each GOP now represents 1 second of video. <br><br></div>When the current GOP is full you <br> 1 put a pointer to it into the ring buffer<br></div><div> 2 get the pointer to the next space in the buffer and reallocate and fill it in. <br><br></div><div>and so on. You always have 10 seconds worth of video avail. You just copy them out or write them out etc.<br><br></div><div>nal <br></div><div>7 - 8 start frame push 7 into keyframe buffer<br></div><div>8 - 5 push 8 into keyframe buffer<br></div><div>5 - 5 push 5 into keyframe buffer<br></div><div>5 - 1 push 5 into keyframe buffer <br></div><div>1 -1 push 1 into diff frame buffer and increment counter<br></div><div>1 - 7 or 1-5 push 1 into last diff frame, set counter to final value and put GOP into ring buffer. Start new GOP<br><br></div><div>repeat. <br><br></div><div>Get it?<br></div><div><br></div><div><br><br></div><br><div><div><div><div><br><div><div><br><br><br><div><br><div><div><div><div><div><div><div><br><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 3, 2014 at 6:52 PM, Mark Bondurant <span dir="ltr"><<a href="mailto:markb@virtualguard.com" target="_blank">markb@virtualguard.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">As you surly must know, I'm a noob thrust unwillingly by circumstances into this.
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">This is helpful. I don't need frames, just ten seconds of stream. But, doesn't H264 have a definite beginning with the following NAL packets updating the initial
packet? That's what all that predictive slices and three dimensional compression and such does? I don't think I can just jump into the middle of the stream and start grabbing packets and still have a usable stream, which is why I was thinking about converting
it to mpeg or something.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> live-devel [mailto:<a href="mailto:live-devel-bounces@ns.live555.com" target="_blank">live-devel-bounces@ns.live555.com</a>]
<b>On Behalf Of </b>Ross Finlayson<br>
<b>Sent:</b> Monday, November 03, 2014 3:35 PM<br>
<b>To:</b> LIVE555 Streaming Media - development & use<br>
<b>Subject:</b> Re: [Live-devel] Buffering an H264 Video Stream<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">Also, part of the problem here, I think, is that you seem to be confused by what the class “H264VideoStreamFramer” does. This class takes as input an unstructured H.264 byte stream, and parses it into discrete
H.264 NAL units. It *does not* combine multiple H.264 NAL units into a single ‘access unit’ (i.e., picture). If you want to do this (or any other processing on the incoming H.264 NAL units), then you’ll need to do this yourself. The LIVE555 libraries do
not contain any video ‘codec’ (i.e., decoding or encoding) functionality.<u></u><u></u></p>
<div>
<p class="MsoNormal"><span><span style="font-family:"Helvetica","sans-serif";color:black">Ross Finlayson</span></span><span style="font-family:"Helvetica","sans-serif";color:black"><br>
<span>Live Networks, Inc.</span><br>
<span><a href="http://www.live555.com/" target="_blank">http://www.live555.com/</a></span></span>
<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
<br>_______________________________________________<br>
live-devel mailing list<br>
<a href="mailto:live-devel@lists.live555.com">live-devel@lists.live555.com</a><br>
<a href="http://lists.live555.com/mailman/listinfo/live-devel" target="_blank">http://lists.live555.com/mailman/listinfo/live-devel</a><br>
<br></blockquote></div><br></div>