<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=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@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;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-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";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.EmailStyle20
        {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;
        font-size:10.0pt;}
@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='color:#1F497D'>You may be doing a bit more work than is necessary. Most H264 streams have the SPS and PPS embedded periodically.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>Here is my setup, note the extradata is set to NULL and size set to 0. This you need to do then on decode of the first frame liavcode fills in the rest of the context.<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:1.5in;text-indent:.5in;text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>pCodec_ = avcodec_find_decoder(CODEC_ID_H264);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                           <span style='color:blue'>if</span> (!pCodecCtx_) {<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                                  <span style='color:blue'>throw</span> std::exception(<span style='color:#A31515'>"[CH264Filter]: Can't allocate pCodecCtx_!"</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                           }<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                            pCodecCtx_ = avcodec_alloc_context();<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                     <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                           <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                           pCodecCtx_->skip_frame            = AVDISCARD_DEFAULT;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                           pCodecCtx_->skip_idct             = AVDISCARD_DEFAULT;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                           pCodecCtx_->skip_loop_filter    = AVDISCARD_DEFAULT;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                           pCodecCtx_->error_concealment   = FF_EC_GUESS_MVS | FF_EC_DEBLOCK ;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                           <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                     <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                           pCodecCtx_->workaround_bugs     = FF_BUG_AUTODETECT | FF_BUG_MS;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                           pCodecCtx_->strict_std_compliance = FF_COMPLIANCE_NORMAL | FF_COMPLIANCE_UNOFFICIAL;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                           pCodecCtx_->error_recognition   = FF_ER_CAREFUL;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                           pCodecCtx_->codec_type            = CODEC_TYPE_VIDEO;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                           pCodecCtx_->codec_id            = CODEC_ID_H264;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                           pCodecCtx_->codec_tag             =  MKTAG(<span style='color:#A31515'>'H'</span>, <span style='color:#A31515'>'2'</span>, <span style='color:#A31515'>'6'</span>, <span style='color:#A31515'>'4'</span>); <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                           pCodecCtx_->extradata             = NULL;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                           pCodecCtx_->extradata_size        = 0;<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                     <o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                           res = avcodec_open(pCodecCtx_, pCodec_);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                           <span style='color:blue'>if</span>(res < 0)<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>                                  <span style='color:blue'>throw</span> std::exception(<span style='color:#A31515'>"Can't open video codec!"</span>);<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'>I actually create the SPS and PPS from the spprops and insert them into the stream if the encoder does not do already do that for me. (Like VLC does when capturing) <o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></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-bounces@ns.live555.com [mailto:live-devel-bounces@ns.live555.com] <b>On Behalf Of </b>Jer Morrill<br><b>Sent:</b> Wednesday, January 11, 2012 6:51 PM<br><b>To:</b> LIVE555 Streaming Media - development & use<br><b>Subject:</b> Re: [Live-devel] "no frame!"<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='color:#1F497D'>I just implemented an custom H264 source and decoder with FFMPEG.  Here’s how I did it (in concept):<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoListParagraph style='text-indent:-.25in'><span style='color:#1F497D'>1.)</span><span style='font-size:7.0pt;font-family:"Times New Roman","serif";color:#1F497D'>    </span><span style='color:#1F497D'>Get the subsession->fmtp_configuration() string<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-.25in'><span style='color:#1F497D'>2.)</span><span style='font-size:7.0pt;font-family:"Times New Roman","serif";color:#1F497D'>    </span><span style='color:#1F497D'>Do something like this with H264VideoRTPSource.hh included – “auto records = parseSPropParameters(fmtp_configuration, recordCount);”<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-.25in'><span style='color:#1F497D'>3.)</span><span style='font-size:7.0pt;font-family:"Times New Roman","serif";color:#1F497D'>    </span><span style='color:#1F497D'>Each of the returned records from step 2, prepend a 0x00000001<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-.25in'><span style='color:#1F497D'>4.)</span><span style='font-size:7.0pt;font-family:"Times New Roman","serif";color:#1F497D'>    </span><span style='color:#1F497D'>Each sample you send to FFMPEG, prepend each of your records from step 3 to your sample buffer<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>I’m not sure if I’m telling you incorrect information, but this worked for me!<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='color:#1F497D'>-Jer<o:p></o:p></span></p><p class=MsoNormal><span style='color:#1F497D'><o:p> </o:p></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"'> <a href="mailto:live-devel-bounces@ns.live555.com">live-devel-bounces@ns.live555.com</a> <a href="mailto:[mailto:live-devel-bounces@ns.live555.com]">[mailto:live-devel-bounces@ns.live555.com]</a> <b>On Behalf Of </b>Menne, Neil<br><b>Sent:</b> Wednesday, January 11, 2012 2:54 PM<br><b>To:</b> <a href="mailto:live-devel@lists.live555.com">live-devel@lists.live555.com</a><br><b>Subject:</b> [Live-devel] "no frame!"<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I’m working on my Live555/FFmpeg video player, and I ran into an interesting problem that has kept me stumped for several days. I am taking the buffer that is delivered to my MediaSink (like the example in testRTSPClient), and I am passing the buffer and the size to FFmpeg to decode. It says that there is “no frame!” I’m stumped as to why that is the case when I’m taking the buffer after the “afterGettingFrame” function is called. I was wondering if there was something else that must be done to that buffer for it to be a true frame that can be decoded.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>My first guess is that the decoder needs more information which brings me to my next question: the SDP description that I’m pulling down doesn’t contain the width/height, so I’m guessing I need to pull that out of the sprop_parameter_sets; is this the case?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>My second guess is that there is no frame separator; I noticed that in one particular file: H264VideoFileSink they prepend a 0x00000001 along with the sprop_parameters. Is this a potential problem?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Video is not my expertise, so I’m spending most days reading anything/everything on these problems, but this one’s got me stuck.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>-Neil<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>P.S. My video is an H.264 video stream<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><div class=MsoNormal align=center style='text-align:center'><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'><hr size=1 width="100%" noshade style='color:#A0A0A0' align=center></span></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>No virus found in this message.<br>Checked by AVG - <a href="http://www.avg.com">www.avg.com</a><br>Version: 2012.0.1901 / Virus Database: 2109/4737 - Release Date: 01/11/12<o:p></o:p></span></p></div></body></html>