<div dir="ltr"><div dir="ltr"></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 28, 2023 at 7:53 PM Michael Wood <<a href="mailto:mornwood23@gmail.com">mornwood23@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Yeah that is correct,<br><br>I'm still unable to fix it, i'm trying to figure out what could cause the frame to not be properly decoded.<div><br></div><div>Best,<br>Milos</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 25, 2023 at 2:48 PM Strahinja Radman <<a href="mailto:dr.strashni@gmail.com" target="_blank">dr.strashni@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><br><div><br><blockquote type="cite"><div>On 25. 3. 2023., at 13:26, Michael Wood <<a href="mailto:mornwood23@gmail.com" target="_blank">mornwood23@gmail.com</a>> wrote:</div><br><div><div dir="ltr">Hi Strahinja,<div><br></div><div>Thanks for the help,</div><div><br></div><div>I'm wondering if I need to update extradata (VPS,SPS,PPS) after initial setup of the AVCodecContext from the initial value coming from RTP ?</div><div><br></div><div>Best,</div><div>Milos</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Mar 25, 2023 at 11:25 AM Strahinja Radman <<a href="mailto:dr.strashni@gmail.com" target="_blank">dr.strashni@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><br></div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 25 Mar 2023 at 11:09, Michael Wood <<a href="mailto:mornwood23@gmail.com" target="_blank">mornwood23@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 24, 2023 at 1:40 PM Strahinja Radman <<a href="mailto:dr.strashni@gmail.com" target="_blank">dr.strashni@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><br><div><br><blockquote type="cite"><div>On 24. 3. 2023., at 10:59, Michael Wood <<a href="mailto:mornwood23@gmail.com" target="_blank">mornwood23@gmail.com</a>> wrote:</div><br><div><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 24, 2023 at 10:28 AM Strahinja Radman <<a href="mailto:dr.strashni@gmail.com" target="_blank">dr.strashni@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><br><br><blockquote type="cite">On 23. 3. 2023., at 20:19, Michael Wood <<a href="mailto:mornwood23@gmail.com" target="_blank">mornwood23@gmail.com</a>> wrote:<br><br><br><br>On Thu, Mar 23, 2023 at 8:06 PM Strahinja Radman <<a href="mailto:dr.strashni@gmail.com" target="_blank">dr.strashni@gmail.com</a>> wrote:<br><br><br>On Thu, 23 Mar 2023 at 20:05, Michael Wood <<a href="mailto:mornwood23@gmail.com" target="_blank">mornwood23@gmail.com</a>> wrote:<br><br><br>On Thu, Mar 23, 2023 at 6:20 PM Michael Wood <<a href="mailto:mornwood23@gmail.com" target="_blank">mornwood23@gmail.com</a>> wrote:<br>Hi,<br><br>I'm having a weird issue with the decoding of H265 4K stream where 1/3 of the frame is rendered normally and the other 2/3 is in green (<a href="https://ibb.co/C8yFygm" target="_blank">https://ibb.co/C8yFygm</a>). This only happens if i try to decode 4K stream, for non 4K streams everything works as expected.<br><br>I'm using live555 library to get stream from RTSP server after which packets are sent to the ffmpeg to be decoded and later rendered<br><br>DESCRIBE response contains all required VPS,SPS,PPS fields that are passed as extra data to the codec context.<br><br>This is what is returned from DESCRIBE:<br><br>v=0<br>o=- 1679598602413481 1679598602413481 IN IP4 192.168.1.212<br>s=Media Presentation<br>e=NONE<br>b=AS:5050<br>t=0 0<br>a=control:rtsp://<a href="http://192.168.1.212/Streaming/Channels/101/?transportmode=unicast&profile=Profile_1" target="_blank">192.168.1.212/Streaming/Channels/101/?transportmode=unicast&profile=Profile_1</a><br>m=video 0 RTP/AVP 96<br>c=IN IP4 0.0.0.0<br>b=AS:5000<br>a=recvonly<br>a=x-dimensions:3840,2160<br>a=control:rtsp://<a href="http://192.168.1.212/Streaming/Channels/101/trackID=1?transportmode=unicast&profile=Profile_1" target="_blank">192.168.1.212/Streaming/Channels/101/trackID=1?transportmode=unicast&profile=Profile_1</a><br>a=rtpmap:96 H265/90000<br>a=fmtp:96 sprop-vps=QAEMA///AWAAAAMAgAAAAwAAAwCWAAC94Eg=; sprop-sps=QgEDAWAAAAMAgAAAAwAAAwCWAACgAeAgAhx/jb33am7uS/YC3AQEBBAAAD6AAALuByHe5RAAmRgACsPgAEyMAAVh8EACZGAAKw+AATIwABWHwg==; sprop-pps=RAHBcrCcCgFGZA==<br>a=Media_header:MEDIAINFO=494D4B48010300000400050000000000000000000000000081000000000000000000000000000000;<br>a=appversion:1.0<br><br>When trying to decode packets i'm getting this output from hevc, the ffplay/VLC works normally with the incoming stream.<br><br>[hevc @ 0x14ac15600] nal_unit_type: 32(VPS), nuh_layer_id: 0, temporal_id: 0<br>[hevc @ 0x14ac15600] nal_unit_type: 33(SPS), nuh_layer_id: 0, temporal_id: 0<br>[hevc @ 0x14ac15600] nal_unit_type: 34(PPS), nuh_layer_id: 0, temporal_id: 0<br>[hevc @ 0x14ac15600] Decoding VPS<br>[hevc @ 0x14ac15600] Main profile bitstream<br>[hevc @ 0x14ac15600] Decoding SPS<br>[hevc @ 0x14ac15600] Main profile bitstream<br>[hevc @ 0x14ac15600] Decoding VUI<br>[hevc @ 0x14ac15600] Decoding PPS<br>[hevc @ 0x14ac15600] nal_unit_type: 32(VPS), nuh_layer_id: 0, temporal_id: 0<br>[hevc @ 0x14ac15600] Decoding VPS<br>[hevc @ 0x14ac15600] Main profile bitstream<br>[hevc @ 0x14ac15600] nal_unit_type: 33(SPS), nuh_layer_id: 0, temporal_id: 0<br>[hevc @ 0x14ac15600] Decoding SPS<br>[hevc @ 0x14ac15600] Main profile bitstream<br>[hevc @ 0x14ac15600] Decoding VUI<br>[hevc @ 0x14ac15600] nal_unit_type: 34(PPS), nuh_layer_id: 0, temporal_id: 0<br>[hevc @ 0x14ac15600] Decoding PPS<br>[hevc @ 0x14ac15600] nal_unit_type: 19(IDR_W_RADL), nuh_layer_id: 0, temporal_id: 0<br>[hevc @ 0x14ac15600] Format yuvj420p chosen by get_format().<br>[hevc @ 0x14ac15600] Output frame with POC 0.<br>[hevc @ 0x14ac15600] nal_unit_type: 19(IDR_W_RADL), nuh_layer_id: 0, temporal_id: 0<br>[hevc @ 0x14ac15600] First slice in a frame missing.<br>[hevc @ 0x14ac15600] nal_unit_type: 19(IDR_W_RADL), nuh_layer_id: 0, temporal_id: 0<br>[hevc @ 0x14ac15600] First slice in a frame missing.<br>[hevc @ 0x14ac15600] nal_unit_type: 32(VPS), nuh_layer_id: 0, temporal_id: 0<br>[hevc @ 0x14ac15600] Decoding VPS<br>[hevc @ 0x14ac15600] Main profile bitstream<br>[hevc @ 0x14ac15600] nal_unit_type: 33(SPS), nuh_layer_id: 0, temporal_id: 0<br>[hevc @ 0x14ac15600] Decoding SPS<br>[hevc @ 0x14ac15600] Main profile bitstream<br>[hevc @ 0x14ac15600] Decoding VUI<br>[hevc @ 0x14ac15600] nal_unit_type: 34(PPS), nuh_layer_id: 0, temporal_id: 0<br>[hevc @ 0x14ac15600] Decoding PPS<br>[hevc @ 0x14ac15600] nal_unit_type: 19(IDR_W_RADL), nuh_layer_id: 0, temporal_id: 0<br>[hevc @ 0x14ac15600] Output frame with POC 0.<br>[hevc @ 0x14ac15600] nal_unit_type: 19(IDR_W_RADL), nuh_layer_id: 0, temporal_id: 0<br>[hevc @ 0x14ac15600] First slice in a frame missing.<br>[hevc @ 0x14ac15600] nal_unit_type: 19(IDR_W_RADL), nuh_layer_id: 0, temporal_id: 0<br>[hevc @ 0x14ac15600] First slice in a frame missing.<br>[hevc @ 0x14ac15600] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 2<br>[hevc @ 0x14ac15600] Output frame with POC 1.<br>[hevc @ 0x14ac15600] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 2<br>[hevc @ 0x14ac15600] First slice in a frame missing.<br>[hevc @ 0x14ac15600] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 2<br>[hevc @ 0x14ac15600] First slice in a frame missing.<br>[hevc @ 0x14ac15600] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 2<br>[hevc @ 0x14ac15600] Output frame with POC 2.<br>[hevc @ 0x14ac15600] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 2<br>[hevc @ 0x14ac15600] First slice in a frame missing.<br>[hevc @ 0x14ac15600] nal_unit_type: 1(TRAIL_R), nuh_layer_id: 0, temporal_id: 2<br>[hevc @ 0x14ac15600] First slice in a frame missing.<br><br>If I write the stream to the file and play that file either through ffplay or VLC the frames are rendered normally. <br><br>Any suggestion would be welcomed.<br><br>Thanks,<br>Milos<br><br> Hey Strahinja,<br><br>Thanks for the answer,<br><br>Can you provide more info on how to do it ?<br><br>Best,<br>Milos<br>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<br>
Hey Milos,<br><br>In AVFrame structure, check width, height and stride variables. <br><br><br>-- <br><br>Regards<br>Strahinja Radman<br>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".<br><br>Hey Strahinja,<br><br>It seems that both width & height are set correctly. I can't find stride, i don't see any reference to it in the AVFrame header.<br><br>Thanks,<br>Milos<br>
_______________________________________________<br>Libav-user mailing list<br><a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br><a href="https://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br><br>To unsubscribe, visit link above, or email<br><a href="mailto:libav-user-request@ffmpeg.org" target="_blank">libav-user-request@ffmpeg.org</a> with subject "unsubscribe”.<br></blockquote><br>Hey Milos,<br><br>What does a parameter linesize say?<br><br><font size="2">AVFrame->linesize[0]</font><div><font size="2"><br></font></div><div><font size="2">Kind regards,</font></div><div><font size="2">Strahinja<br></font><br><br></div></div></blockquote><div><br></div><div>Hi Strahinja,</div><div><br></div><div>The linesize looks good and corresponds to frame size</div><div><br></div><div>frame->linesize[0] = 3840</div><div>frame->linesize[1] = 1920<br></div><div>frame->linesize[2] = 1920</div><div><br></div><div>Best,</div><div>Milos</div><div><br></div><div><br></div><div> <br></div></div></div>
</div></blockquote><br></div><div>Hey Milos,</div><div><br></div><div>Can you use this method to save one frame to the PGM file and check its contents right after you receive an AVFrame</div><div><br></div><div>static void pgm_save(unsigned char* buf, int wrap, int xsize, int ysize, const char* filename)   </div><div><span> {</span><span>  </span></div><div><span style="white-space:pre-wrap">      </span>FILE* f;        </div><div><span style="white-space:pre-wrap">     </span>int i;</div><div><span>        f = fopen(filename, "w");</span><span>        </span></div><div><span><span style="white-space:pre-wrap">   </span>fprintf(f, "P5\n%d %d\n%d\n", xsize, ysize, 255);</span><span>        </span></div><div><span><span style="white-space:pre-wrap">    </span>for (i = 0; i < ysize; i++)</span><span>            </span></div><div><span><span style="white-space:pre-wrap">         </span>fwrite(buf + i * wrap, 1, xsize, f);</span><span>        </span></div><div><span><span style="white-space:pre-wrap">   </span>fclose(f);</span><span>   </span></div><div><span>}</span><div></div></div><div><br></div><div>buf is frame->data[0]</div><div>wrap is frame->linesize[0]</div><div>xsize is width and ysize is height</div><div><br></div><div>Kind regards,</div><div>Strahinja</div><br></div></blockquote><div><br></div><div id="m_-6449905779598790470m_2185992278991898025m_6225667493625238803m_-4833404196699550602gmail-:80" style="direction:ltr;margin:8px 0px 0px;padding:0px;font-size:0.875rem;font-family:"Google Sans",Roboto,RobotoDraft,Helvetica,Arial,sans-serif"><div id="m_-6449905779598790470m_2185992278991898025m_6225667493625238803m_-4833404196699550602gmail-:81" style="font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-feature-settings:normal;font-stretch:normal;font-size:small;line-height:1.5;font-family:Arial,Helvetica,sans-serif;overflow:hidden"><div dir="ltr" style="font-family:Arial,Helvetica,sans-serif"><div class="gmail_quote" style="font-family:Arial,Helvetica,sans-serif"><div style="font-family:Arial,Helvetica,sans-serif">Hi Strahinja,</div><div style="font-family:Arial,Helvetica,sans-serif"><br></div><div style="font-family:Arial,Helvetica,sans-serif">I'm getting the same result with saved picture, here is the link to the output (<a href="https://drive.google.com/file/d/1zEABl32ehVu-gnPdqjWciAb7im18VZIf/view?usp=sharing" style="font-family:Arial,Helvetica,sans-serif" target="_blank">https://drive.google.com/file/d/1zEABl32ehVu-gnPdqjWciAb7im18VZIf/view?usp=sharing</a>)<br></div><div style="font-family:Arial,Helvetica,sans-serif"><br></div><div style="font-family:Arial,Helvetica,sans-serif">Best,</div><div style="font-family:Arial,Helvetica,sans-serif">Milos</div></div></div></div></div><div> </div></div></div></blockquote><div dir="auto"><br></div><div dir="auto">Hey Milos,</div><div dir="auto"><br></div><div dir="auto">One thing to check is if live555 is configured correctly. Check if every decoder field is set properly and contains expected values. Sometimes stream properties can change during the decoding process and that can affect the output. </div><div dir="auto"><br></div><div dir="auto">Kind regards,</div><div dir="auto">Strahinja</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="auto"></div></div></div>
</blockquote></div></div>-- <br><div dir="ltr"><br>Regards<br>Strahinja Radman</div>
</blockquote></div>
</div></blockquote><br></div><div>Hey Milos,</div><div><br></div><div>That shouldnt be necessary, that information should be used while configuring the decoder context. </div><div><br></div><div>Kind regards,</div><div>Strahinja</div><br></div></blockquote></div></blockquote><div><br></div><div><br></div><div>Update: </div><div><br>So I've managed to figure out what is happening, the NAL units I'm receiving from the live555 library are actually fragments of a single picture. Technically I need to combine those fragments into a single packet and send it to ffmpeg for decoding.</div><div><br></div><div>Any suggestions on how to recognize which fragments belong to a single packet ?</div><div><br></div><div>Best,</div><div>Milos</div></div></div>