<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Sorry for the absence, but I have about a dozen hats to wear.
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<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:live-devel-bounces@ns.live555.com]
<b>On Behalf Of </b>Jeff Shanab<br>
<b>Sent:</b> Monday, November 03, 2014 4:46 PM<br>
<b>To:</b> LIVE555 Streaming Media - development & use<br>
<b>Subject:</b> Re: [Live-devel] Buffering an H264 Video Stream<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Remember that this is an RTSP stream, probably unlike the MJPEG you are use to.
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Wikipedia has a good explanation of the basic RTSP conversation. Live555 implements this protocol (both as server and as client)<o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Read that (the sound of the breeze blowing by over my head), bought a book and read it too. Not helpful in regards to live555 though,
which is more a matter of implementation details. Did read the faqs, although apparently it did me no good.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal">Look at the RTSPCLient.cpp and PlayCommon.cpp to understand the client.<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">After the necessary steps to start up the conversation with the response from each step responsable for sending the next one.<o:p></o:p></p>
</div>
<p class="MsoNormal">OPTIONS<o:p></o:p></p>
</div>
<p class="MsoNormal">DESCRIBE<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">SETUP<br>
PLAY<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"> 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.<o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">So you're saying that, because of the brain dead nature of security of security cameras, I can gather NAL packets into a clip starting
at any point in the stream and expect that clip to play? I don't have to worry about boundaries beyond that?<o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">At that point you need to collect the frames into your buffer for decoding and display. And call GetNextFrame to keep everything moving.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Oversimplified...<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">class GOP<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">{<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">public:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> uint8* m_keyFrame<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> uint8* [] m_diffFrames<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"> int framecount<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> ~GOP(){ // delete all allocated buffers}<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> <br>
} <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">So lets say you have a simple producer consumer ring buffer holding pointers to GOP instances.<o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">A 10 second linked list perhap, dropping the end, adding to the beginning?
<o:p></o:p></span></p>
</div>
<p class="MsoNormal">You maintain a statemachine watching the transitions of nal unit types and fill in the GOP's with the bytes for each frame.<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Each GOP now represents 1 second of video.
<o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Ah, so there is a boundary in the NAL's that I need to watch for, that initial frame that the following packets are moding. You
mentioned this earlier:<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt">[7][8][5][1][1][1][1][1][1][1][1]....<o:p></o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal">When the current GOP is full you <br>
1 put a pointer to it into the ring buffer<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"> 2 get the pointer to the next space in the buffer and reallocate and fill it in.
<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">and so on. You always have 10 seconds worth of video avail. You just copy them out or write them out etc.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">nal <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">7 - 8 start frame push 7 into keyframe buffer<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">8 - 5 push 8 into keyframe buffer<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">5 - 5 push 5 into keyframe buffer<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">5 - 1 push 5 into keyframe buffer <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">1 -1 push 1 into diff frame buffer and increment counter<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">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<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">repeat. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Get it?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="color:#1F497D">7, 8,5,1, are these actual identifiers, like a NAL packet type?</span><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
<br>
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Mon, Nov 3, 2014 at 6:52 PM, Mark Bondurant <<a href="mailto:markb@virtualguard.com" target="_blank">markb@virtualguard.com</a>> wrote:<o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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.
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;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.<o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Helvetica","sans-serif";color:black">Ross Finlayson<br>
Live Networks, Inc.<br>
<a href="http://www.live555.com/" target="_blank">http://www.live555.com/</a></span>
<o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><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><o:p></o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>