<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">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi,</p>
<p><br>
</p>
<p>Previous issue is gone now but now I see another message:</p>
<p>I have adapted my code as below:</p>
<p><br>
</p>
<p></p>
<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><span style=" color:#808000;">for</span><span style=" color:#c0c0c0;"> </span>(i<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>;<span style=" color:#c0c0c0;"> </span>i<span style=" color:#c0c0c0;"> </span><<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">iNal</span>;<span style=" color:#c0c0c0;"> </span>i++)<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:#c0c0c0;"> </span>offset,<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">pNals</span>[i].<span style=" color:#800000;">payload</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">pNals</span>[i].<span style=" color:#800000;">sizeBytes</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>offset<span style=" color:#c0c0c0;"> </span>+=<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">pNals</span>[i].<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;"><span style=" color:#c0c0c0;"> </span>*aFrameBufferSize<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>offset;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<br>
<p></p>
<p><br>
</p>
<p>Now I see the following at the gstreamer side:</p>
<p></p>
<div>GST_DEBUG=h265*:4 gst-launch-1.0 filesrc location=/store/dumpedEncodedStream.265 ! h265parse ! fakesink</div>
<div>Setting pipeline to PAUSED ...</div>
<div>Pipeline is PREROLLING ...</div>
<div>0:00:00.133435240 10458 0x1424ca0 INFO h265parse gsth265parse.c:1450:gst_h265_parse_update_src_caps:<h265parse0> resolution changed 1728x1088</div>
<div>0:00:00.133481722 10458 0x1424ca0 INFO h265parse gsth265parse.c:1462:gst_h265_parse_update_src_caps:<h265parse0> framerate changed 25/1</div>
<div>0:00:00.133549647 10458 0x1424ca0 INFO h265parse gsth265parse.c:1509:gst_h265_parse_update_src_caps:<h265parse0> setting framerate in caps</div>
<div>0:00:00.133628726 10458 0x1424ca0 FIXME h265parse gsth265parse.c:1612:gst_h265_parse_parse_frame:<h265parse0> Implement timestamp/duration interpolation based on SEI message</div>
<div>Pipeline is PREROLLED ...</div>
<div>Setting pipeline to PLAYING ...</div>
<div>New clock: GstSystemClock</div>
<div>0:00:00.134707710 10458 0x1424ca0 INFO h265parse gsth265parse.c:1509:gst_h265_parse_update_src_caps:<h265parse0> setting framerate in caps</div>
<div>0:00:00.134769508 10458 0x1424ca0 FIXME h265parse gsth265parse.c:1612:gst_h265_parse_parse_frame:<h265parse0> Implement timestamp/duration interpolation based on SEI message</div>
<div>0:00:00.135041699 10458 0x1424ca0 FIXME h265parse gsth265parse.c:1612:gst_h265_parse_parse_frame:<h265parse0> Implement timestamp/duration interpolation based on SEI message</div>
<div>0:00:00.135199848 10458 0x1424ca0 FIXME h265parse gsth265parse.c:1612:gst_h265_parse_parse_frame:<h265parse0> Implement timestamp/duration interpolation based on SEI message</div>
<div>0:00:00.135293074 10458 0x1424ca0 FIXME h265parse gsth265parse.c:1612:gst_h265_parse_parse_frame:<h265parse0> Implement timestamp/duration interpolation based on SEI message</div>
<div><span style="font-size: 12pt;">0:00:00.138458683 10458 0x1424ca0 FIXME h265parse gsth265parse.c:1612:gst_h265_parse_parse_frame:<h265parse0> Implement timestamp/duration interpolation based on SEI message</span><br>
</div>
<div>0:00:00.138573135 10458 0x1424ca0 FIXME h265parse gsth265parse.c:1612:gst_h265_parse_parse_frame:<h265parse0> Implement timestamp/duration interpolation based on SEI message</div>
<div>0:00:00.138670004 10458 0x1424ca0 FIXME h265parse gsth265parse.c:1612:gst_h265_parse_parse_frame:<h265parse0> Implement timestamp/duration interpolation based on SEI message</div>
<div><span style="font-size: 12pt;">0:00:00.139797938 10458 0x1424ca0 FIXME h265parse gsth265parse.c:1612:gst_h265_parse_parse_frame:<h265parse0> Implement timestamp/duration interpolation based on SEI message</span><br>
</div>
<div>0:00:00.139880238 10458 0x1424ca0 FIXME h265parse gsth265parse.c:1612:gst_h265_parse_parse_frame:<h265parse0> Implement timestamp/duration interpolation based on SEI message</div>
<div>Got EOS from element "pipeline0".</div>
<div>Execution ended after 0:00:00.005692448</div>
<div>Setting pipeline to PAUSED ...</div>
<div>Setting pipeline to READY ...</div>
<div>Setting pipeline to NULL ...</div>
<div>Freeing pipeline ...</div>
<br>
<p></p>
<p>Is there still something missing?</p>
<p>Regards,</p>
<p><br>
</p>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> x265-devel <x265-devel-bounces@videolan.org> on behalf of Pradeep Ramachandran <pradeep@multicorewareinc.com><br>
<b>Sent:</b> Friday, August 12, 2016 3:02 AM<br>
<b>To:</b> Development for x265<br>
<b>Subject:</b> Re: [x265] no SPS/PPS yet, * will be dropped</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div class="gmail_extra"><br>
<div class="gmail_quote">On Fri, Aug 12, 2016 at 7:14 AM, Deepthi Nandakumar <span dir="ltr">
<<a href="mailto:deepthipnandakumar@gmail.com" target="_blank">deepthipnandakumar@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<p dir="ltr">You're handling pNals wrongly. framesize may be 1, but number of NALs in the stream may be greater than 1 (=iNal). So you need to copy all of those, not just pNals[0].
<br>
</p>
<div class="gmail_quote">
<div>
<div class="h5">On 12-Aug-2016 2:53 am, "Dolevo Jay" <<a href="mailto:cmst@live.com" target="_blank">cmst@live.com</a>> wrote:<br type="attribution">
</div>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<div class="h5">
<div dir="ltr">
<div 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">para<wbr>m</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>);</pre>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote>
<div><br>
</div>
<div>You need to iterate over iNal and copy the payload for all the pNals from 0 to iNal.</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<div class="h5">
<div dir="ltr">
<div style="font-size:12pt; color:#000000; background-color:#ffffff; font-family:Calibri,Arial,Helvetica,sans-serif">
<pre style="margin-top:0px; margin-bottom:0px"><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">con<wbr>st</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>
<br>
</div>
</div>
______________________________<wbr>_________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org" target="_blank">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/l<wbr>istinfo/x265-devel</a><br>
<br>
</blockquote>
</div>
<br>
______________________________<wbr>_________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" rel="noreferrer" target="_blank">https://mailman.videolan.org/<wbr>listinfo/x265-devel</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>