<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 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;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
h1
        {mso-style-priority:9;
        mso-style-link:"Heading 1 Char";
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:24.0pt;
        font-family:"Times New Roman","serif";
        font-weight:bold;}
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
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.Heading1Char
        {mso-style-name:"Heading 1 Char";
        mso-style-priority:9;
        mso-style-link:"Heading 1";
        font-family:"Times New Roman","serif";
        font-weight:bold;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
.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">Hello All,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:14.65pt;background:white">
<span style="font-size:11.5pt;font-family:"Helvetica","sans-serif";color:#222222">I am trying to decode H264 video frames received through RTSP streaming.<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;line-height:14.65pt;background:white;orphans: auto;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span style="font-size:11.5pt;font-family:"Helvetica","sans-serif";color:#222222">I followed this post:<span class="apple-converted-space"> </span><a href="http://stackoverflow.com/questions/7665217/how-to-process-raw-udp-packets-so-that-they-can-be-decoded-by-a-decoder-filter-i"><span style="color:#0C65A5;border:none windowtext 1.0pt;padding:0in">How
 to process raw UDP packets so that they can be decoded by a decoder filter in a directshow source filter</span></a><o:p></o:p></span></p>
<p style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:14.65pt;background:white;orphans: auto;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span style="font-size:11.5pt;font-family:"Helvetica","sans-serif";color:#222222">I was able to identify start of the frame & end of the frame in RTP packets and reconstructed my Video Frame.<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;line-height:14.65pt;background:white;orphans: auto;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span style="font-size:11.5pt;font-family:"Helvetica","sans-serif";color:#222222">But I<span class="apple-converted-space"> </span><strong><span style="font-family:"Helvetica","sans-serif";border:none windowtext 1.0pt;padding:0in">didnt receive</span></strong><span class="apple-converted-space"> </span>any
 SPS,PPS data from my RTSP session. I looked for string<span class="apple-converted-space"> </span><strong><span style="font-family:"Helvetica","sans-serif";border:none windowtext 1.0pt;padding:0in">"sprop-parameter-sets"</span></strong><span class="apple-converted-space"> </span>in
 my<span class="apple-converted-space"> </span><strong><span style="font-family:"Helvetica","sans-serif";border:none windowtext 1.0pt;padding:0in">SDP(Session Description Protocol)</span></strong><span class="apple-converted-space"> </span>and there was none.<o:p></o:p></span></p>
<h1 style="margin:0in;margin-bottom:.0001pt;background:white;word-wrap: break-word;orphans: auto;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<strong><span style="font-size:16.0pt;font-family:"Helvetica","sans-serif";color:#222222;border:none windowtext 1.0pt;padding:0in"><o:p> </o:p></span></strong></h1>
<h1 style="margin:0in;margin-bottom:.0001pt;background:white"><strong><span style="font-size:16.0pt;font-family:"Helvetica","sans-serif";color:#222222;border:none windowtext 1.0pt;padding:0in">Reconstructing Video Frame from RTP Packets:</span></strong><span style="font-size:16.0pt;font-family:"Helvetica","sans-serif";color:#222222"><o:p></o:p></span></h1>
<p style="margin:0in;margin-bottom:.0001pt;line-height:14.65pt;background:white;orphans: auto;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span style="font-size:11.5pt;font-family:"Helvetica","sans-serif";color:#222222">Payload in the first RTP Packet goes like this :<span class="apple-converted-space"> </span><strong><span style="font-family:"Helvetica","sans-serif";border:none windowtext 1.0pt;padding:0in">"1c
 80 00 00 01 61 9a 03 03 6a 59 ff 97 e0 a9 f6"</span></strong><o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;line-height:14.65pt;background:white;orphans: auto;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span style="font-size:11.5pt;font-family:"Helvetica","sans-serif";color:#222222">This says that it’s a fragmented data(<strong><span style="font-family:"Helvetica","sans-serif";border:none windowtext 1.0pt;padding:0in">"1C"</span></strong>) and start of the
 frame(<strong><span style="font-family:"Helvetica","sans-serif";border:none windowtext 1.0pt;padding:0in">"80"</span></strong>). I copied the rest of the<strong><span style="font-family:"Helvetica","sans-serif";border:none windowtext 1.0pt;padding:0in">payload
 data(except the first 2 bytes "1C 80")</span></strong>.<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;line-height:14.65pt;background:white;orphans: auto;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span style="font-size:11.5pt;font-family:"Helvetica","sans-serif";color:#222222">Following RTP Packets have the "Payload" start with<span class="apple-converted-space"> </span><strong><span style="font-family:"Helvetica","sans-serif";border:none windowtext 1.0pt;padding:0in">"1C
 00"</span></strong><span class="apple-converted-space"> </span>which is continuation of the frame data. I kept adding payload data(except the first 2 bytes<span class="apple-converted-space"> </span><strong><span style="font-family:"Helvetica","sans-serif";border:none windowtext 1.0pt;padding:0in">"1C
 00"</span></strong>) into the byte buffer for all the following RTP Packets.<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;line-height:14.65pt;background:white;orphans: auto;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span style="font-size:11.5pt;font-family:"Helvetica","sans-serif";color:#222222">When I get the RTP packet with payload starts with<span class="apple-converted-space"> </span><strong><span style="font-family:"Helvetica","sans-serif";border:none windowtext 1.0pt;padding:0in">"1C
 40"</span></strong>, which is end of the frame, I copied the rest of the payload data(except the first 2 bytes<span class="apple-converted-space"> </span><strong><span style="font-family:"Helvetica","sans-serif";border:none windowtext 1.0pt;padding:0in">"1C
 40"</span></strong>) of that RTP Packet into the byte buffer.<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:14.65pt;background:white;orphans: auto;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span style="font-size:11.5pt;font-family:"Helvetica","sans-serif";color:#222222">Thus I reconstructed the Video Frame into the byte buffer.<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;line-height:14.65pt;background:white;orphans: auto;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span style="font-size:11.5pt;font-family:"Helvetica","sans-serif";color:#222222">Then I prepended 4 bytes<span class="apple-converted-space"> </span><strong><span style="font-family:"Helvetica","sans-serif";border:none windowtext 1.0pt;padding:0in">[0x00,
 0x00 , 0x00, 0x01]</span></strong><span class="apple-converted-space"> </span>to the byte buffer before sending to the decoder, because I didnt receive any SPS, PPS NAL bytes.<o:p></o:p></span></p>
<p style="margin:0in;margin-bottom:.0001pt;line-height:14.65pt;background:white;orphans: auto;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span style="font-size:11.5pt;font-family:"Helvetica","sans-serif";color:#222222">When I send this byte buffer to the decoder, decoder fails when it tries to<span class="apple-converted-space"> </span><strong><span style="font-family:"Helvetica","sans-serif";border:none windowtext 1.0pt;padding:0in">initialize
 sws Context</span></strong>.<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:14.65pt;background:white;orphans: auto;widows: auto;-webkit-text-stroke-width: 0px;word-spacing:0px">
<span style="font-size:11.5pt;font-family:"Helvetica","sans-serif";color:#222222">Am I sending the NAL bytes and video frame data correctly?<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:14.65pt;background:white">
<span style="font-size:11.5pt;font-family:"Helvetica","sans-serif";color:#222222"><o:p> </o:p></span></p>
<p style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:14.65pt;background:white">
<span style="font-size:11.5pt;font-family:"Helvetica","sans-serif";color:#222222">Appreciate any help on this.<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:14.65pt;background:white">
<span style="font-size:11.5pt;font-family:"Helvetica","sans-serif";color:#222222"><o:p> </o:p></span></p>
<p style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:14.65pt;background:white">
<span style="font-size:11.5pt;font-family:"Helvetica","sans-serif";color:#222222">Thanks,<o:p></o:p></span></p>
<p style="mso-margin-top-alt:0in;margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:14.65pt;background:white">
<span style="font-size:11.5pt;font-family:"Helvetica","sans-serif";color:#222222">Praveen<o:p></o:p></span></p>
</div>
</body>
</html>