<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Sorry for my previous unfinished email.  Let me continue here:</p>
<p><br>
</p>
<p>After encoding some fr<span style="color: rgb(0, 0, 0);">ames, I get the bitstream in </span><span style="color: rgb(128, 0, 0);"><span style="color: rgb(0, 0, 0);">dumpfileEncodedData. In order to verify that this is a valid bitstream, I wanted to play
 this file with gstreamer (just for easiness</span><span style="color: rgb(0, 0, 0);">)</span><span style="color: rgb(0, 0, 0);">.  I run the
<span style="font-family: Arial, Helvetica, sans-serif;">following pipeline:</span></span></span></p>
<p><span style="color: rgb(128, 0, 0);"><br>
</span></p>
<p><span style="color: rgb(128, 0, 0);"><span style="font-size: 9pt; font-family: "Times New Roman", serif; color: rgb(0, 0, 0);"><span style="font-family: Arial, Helvetica, sans-serif;">GST_DEBUG=h265*:4 gst-launch-1.0 filesrc location=</span><span style="font-family: Arial, Helvetica, sans-serif;">dumpedEncodedStream.265
 ! h265parse ! fakesink</span></span><br>
</span></p>
<p><span style="color: rgb(128, 0, 0);"><span style="font-size: 9pt; font-family: "Times New Roman", serif; color: rgb(0, 0, 0);"><br>
</span></span></p>
<p><span style="color: rgb(128, 0, 0);"><span style="font-size: 9pt; font-family: Arial, Helvetica, sans-serif; color: rgb(0, 0, 0);">I get the following messages from Gstreamer:</span></span></p>
<p><span style="color: rgb(128, 0, 0);"><span style="font-size: 9pt; font-family: "Times New Roman", serif; color: rgb(0, 0, 0);"><br>
</span></span></p>
<p><span style="color: rgb(128, 0, 0);"><span style="font-size: 9pt; font-family: "Times New Roman", serif; color: rgb(0, 0, 0);"></p>
<p style="margin:0cm;margin-bottom:.0001pt;background:black"><span style="font-size: 9pt; color: rgb(41, 249, 20); font-family: Arial, Helvetica, sans-serif;">Setting pipeline to PAUSED ...</span><o:p></o:p></p>
<span style="font-family: Arial, Helvetica, sans-serif;"></span>
<p style="margin:0cm;margin-bottom:.0001pt;background:black"><span style="font-size: 9pt; color: rgb(41, 249, 20); font-family: Arial, Helvetica, sans-serif;">Pipeline is PREROLLING ...</span><o:p></o:p></p>
<span style="font-family: Arial, Helvetica, sans-serif;"></span>
<p style="margin:0cm;margin-bottom:.0001pt;background:black"><span style="font-size: 9pt; color: rgb(41, 249, 20); font-family: Arial, Helvetica, sans-serif;">0:00:00.026579000 31834 0x7fd3ac8289e0
</span><span style="font-size: 9pt; color: rgb(175, 173, 36); font-family: Arial, Helvetica, sans-serif;">WARN  
</span><span style="font-size: 9pt; color: rgb(41, 249, 20); font-family: Arial, Helvetica, sans-serif;">            h265parse gsth265parse.c:981:gst_h265_parse_handle_frame:<h265parse0> no SPS/PPS yet, nal Type: 19 SLICE_IDR_W_RADL, Size: 344694 will be dropped</span><o:p></o:p></p>
<span style="font-family: Arial, Helvetica, sans-serif;"></span>
<p style="margin:0cm;margin-bottom:.0001pt;background:black"><span style="font-size: 9pt; color: rgb(41, 249, 20); font-family: Arial, Helvetica, sans-serif;">0:00:00.026784000 31834 0x7fd3ac8289e0
</span><span style="font-size: 9pt; color: rgb(175, 173, 36); font-family: Arial, Helvetica, sans-serif;">WARN  
</span><span style="font-size: 9pt; color: rgb(41, 249, 20); font-family: Arial, Helvetica, sans-serif;">            h265parse gsth265parse.c:981:gst_h265_parse_handle_frame:<h265parse0> no SPS/PPS yet, nal Type: 1 Slice_TRAIL_R, Size: 61343 will be dropped</span><o:p></o:p></p>
<span style="font-family: Arial, Helvetica, sans-serif;"></span>
<p style="margin:0cm;margin-bottom:.0001pt;background:black"><span style="font-size: 9pt; color: rgb(41, 249, 20); font-family: Arial, Helvetica, sans-serif;">0:00:00.026922000 31834 0x7fd3ac8289e0
</span><span style="font-size: 9pt; color: rgb(175, 173, 36); font-family: Arial, Helvetica, sans-serif;">WARN  
</span><span style="font-size: 9pt; color: rgb(41, 249, 20); font-family: Arial, Helvetica, sans-serif;">            h265parse gsth265parse.c:981:gst_h265_parse_handle_frame:<h265parse0> no SPS/PPS yet, nal Type: 1 Slice_TRAIL_R, Size: 77539 will be dropped</span><o:p></o:p></p>
<span style="font-family: Arial, Helvetica, sans-serif;"></span>
<p style="margin:0cm;margin-bottom:.0001pt;background:black"><span style="font-size: 9pt; color: rgb(41, 249, 20); font-family: Arial, Helvetica, sans-serif;">0:00:00.027144000 31834 0x7fd3ac8289e0
</span><span style="font-size: 9pt; color: rgb(175, 173, 36); font-family: Arial, Helvetica, sans-serif;">WARN  
</span><span style="font-size: 9pt; color: rgb(41, 249, 20); font-family: Arial, Helvetica, sans-serif;">            h265parse gsth265parse.c:981:gst_h265_parse_handle_frame:<h265parse0> no SPS/PPS yet, nal Type: 1 Slice_TRAIL_R, Size: 80666 will be dropped</span><o:p></o:p></p>
<br>
</span></span>
<p></p>
<p><span style="color: rgb(128, 0, 0);"><span style="font-size: 9pt; font-family: "Times New Roman", serif; color: rgb(0, 0, 0);"><span style="font-family: Arial, Helvetica, sans-serif;">So, my frames are being dropped </span><span style="font-family: Arial, Helvetica, sans-serif;">for
 some reason. Could anyone shed some light what the problem would be?</span></span></span></p>
<p><span style="color: rgb(128, 0, 0);"><span style="font-size: 9pt; font-family: "Times New Roman", serif; color: rgb(0, 0, 0);"><span style="font-family: Arial, Helvetica, sans-serif;"><br>
</span></span></span></p>
<p><span style="color: rgb(128, 0, 0);"><span style="font-size: 9pt; font-family: "Times New Roman", serif; color: rgb(0, 0, 0);"><span style="font-family: Arial, Helvetica, sans-serif;">Thanks in advance,</span></span></span></p>
<p><span style="color: rgb(128, 0, 0);"><span style="font-size: 9pt; font-family: "Times New Roman", serif; color: rgb(0, 0, 0);"><span style="font-family: Arial, Helvetica, sans-serif;">Regards</span></span></span></p>
<p><br>
</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> x265-devel <x265-devel-bounces@videolan.org> on behalf of Dolevo Jay <cmst@live.com><br>
<b>Sent:</b> Thursday, August 11, 2016 9:23:26 PM<br>
<b>To:</b> x265-devel@videolan.org<br>
<b>Subject:</b> [x265] no SPS/PPS yet, * will be dropped</font>
<div> </div>
</div>
<div>
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi all,</p>
<p><br>
</p>
<p>In my encoder application, I initialize the encoder as follows:</p>
<p><br>
</p>
<p></p>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#800000;">    param</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>x265_param_alloc();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>x265_param_default(<span style=" color:#800000;">param</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>x265_param_default_preset(<span style=" color:#800000;">param</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"ultrafast"</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"zerolatency"</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">param</span>-><span style=" color:#800000;">fpsNum</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">25</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">param</span>-><span style=" color:#800000;">fpsDenom</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">1</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">param</span>-><span style=" color:#800000;">bRepeatHeaders</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">true</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">param</span>-><span style=" color:#800000;">internalCsp</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">X265_CSP_I420</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">param</span>-><span style=" color:#800000;">sourceWidth</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>aWidth;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">param</span>-><span style=" color:#800000;">sourceHeight</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>aHeight;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">y_size</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">param</span>-><span style=" color:#800000;">sourceWidth</span><span style=" color:#c0c0c0;"> </span>*<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">param</span>-><span style=" color:#800000;">sourceHeight</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">param</span>-><span style=" color:#800000;">logLevel</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">X265_LOG_FULL</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">encoder</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">x265_encoder_open</span>(<span style=" color:#800000;">param</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(<span style=" color:#000080;">NULL</span><span style=" color:#c0c0c0;"> </span>==<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">encoder</span>)<span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">        </span><font color="#800000">print</font><span style="font-style: italic;">Log</span>(<span style=" color:#008000;">"[X265]</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">x265_encoder_open</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">err"</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#808000;">return</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">param</span>-><span style=" color:#800000;">internalCsp</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">X265_CSP_I420</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">pic_in</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>x265_picture_alloc();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>x265_picture_init(<span style=" color:#800000;">param</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">pic_in</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">pic_in</span>-><span style=" color:#800000;">planes</span>[<span style=" color:#000080;">0</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">new</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">char</span>[<span style=" color:#000080;">32000000</span>];</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">pic_in</span>-><span style=" color:#800000;">planes</span>[<span style=" color:#000080;">1</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">new</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">char</span>[<span style=" color:#000080;">32000000</span>];</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">pic_in</span>-><span style=" color:#800000;">planes</span>[<span style=" color:#000080;">2</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">new</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">char</span>[<span style=" color:#000080;">32000000</span>];</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">pic_in</span>-><span style=" color:#800000;">stride</span>[<span style=" color:#000080;">0</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>aWidth;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">pic_in</span>-><span style=" color:#800000;">stride</span>[<span style=" color:#000080;">1</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>aWidth;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">pic_in</span>-><span style=" color:#800000;">stride</span>[<span style=" color:#000080;">2</span>]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>aWidth;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800000;">pic_out</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>x265_picture_alloc();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>x265_picture_init(<span style=" color:#800000;">param</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">pic_out</span>);</pre>
<br>
<p></p>
<p><br>
</p>
<p>Then, I apply the following function for each incoming frame:</p>
<p><br>
</p>
<p></p>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>frame_size<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#800080;">x265_picture</span><span style=" color:#c0c0c0;"> </span>pic_out1;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>frame_size<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>x265_encoder_encode(<span style=" color:#800000;">encoder</span>,<span style=" color:#c0c0c0;"> </span>&<span style=" color:#800000;">pNals</span>,<span style=" color:#c0c0c0;"> </span>&<span style=" color:#800000;">iNal</span>,<span style=" color:#c0c0c0;"> </span>pic_in,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">NULL</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(frame_size<span style=" color:#c0c0c0;"> </span><<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>)<span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">        </span><font color="#800000">print</font><span style="font-style: italic;">Log</span>(<span style=" color:#008000;">"[ERROR]</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">H265:</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">x265_encoder_encode</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">failed."</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">        </span><span style=" color:#808000;">return</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(frame_size<span style=" color:#c0c0c0;"> </span>><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>)<span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">        </span>memcpy(aFramebuffer,<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">pNals</span>[<span style=" color:#000080;">0</span>].<span style=" color:#800000;">payload</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">pNals</span>[<span style=" color:#000080;">0</span>].<span style=" color:#800000;">sizeBytes</span>);<span style=" color:#008000;"></span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">        </span>*aFrameBufferSize<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">pNals</span>[<span style=" color:#000080;">0</span>].<span style=" color:#800000;">sizeBytes</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;">    </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#800000;">    dumpfileEncodedData</span>.write((<span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">char</span><span style=" color:#c0c0c0;"> </span>*)aFramebuffer,<span style=" color:#c0c0c0;"> </span>*aFrameBufferSize);</pre><br></pre>
<br>
<p></p>
<p>Just to debug the encoded bitstream, I dump the data into a file </p>
<p><br>
</p>
</div>
</div>
</body>
</html>