<div dir="ltr">Hi <div><br></div><div>I am working on an application based on FFMPEG version 3.4.2 where the RTSP packets from the camera are captured and store using python. The decoder application is run later.  The application receives a  byte array which is the actual packet. The goal is to decode the received packet and convert it to RGB from YUV. </div><div><br></div><div>When I feed it packets I see the following output </div><div><br></div><div><div>Creating the codec h264</div><div>Creating the codec context</div><div><span style="background-color:rgb(255,255,0)">[h264 @ 0x557a3846d880] nal_unit_type: 7, nal_ref_idc: 3</span></div><div><span style="background-color:rgb(255,255,0)">[h264 @ 0x557a3846d880] nal_unit_type: 8, nal_ref_idc: 3                                                                                                                                                                    </span></div><div><span style="background-color:rgb(255,255,0)">[h264 @ 0x557a3846d880] nal_unit_type: 5, nal_ref_idc: 3                                                                                                                                                                    </span></div><div><span style="background-color:rgb(255,255,0)">[h264 @ 0x557a3846d880] Reinit context to 2688x1520, pix_fmt: yuvj420p                                                                                                                                                      </span></div><div>avcodec_send_packet=0                                                                                                                                                                                                       </div><div>avcodec_receive_frame=0, pCodecCtx->frame_number=1</div><div><span style="background-color:rgb(243,243,243)"><font color="#ff0000">[swscaler @ 0x557a385fdb20] bad src image pointers</font></span></div><div>avcodec_send_packet=0                                                                                                                                                                                                       <br></div><div>avcodec_receive_frame=0, pCodecCtx->frame_number=2</div></div><div><div><span style="background-color:rgb(243,243,243)"><font color="#ff0000">[swscaler @ 0x557a385fdb20] bad src image pointers</font></span></div><br class="gmail-m_46473581863419212gmail-m_-3438301535596160804gmail-Apple-interchange-newline"></div><div>I was  wondering why the swscaler is complaining about bad src images. </div><div><br></div><div>Here is the sequence of calls in my code </div><div><br></div><div>1.  av_packet_alloc() and av_packet_init()<br></div><div>     - copy the encoded image to packet->data (I extend it by AV_INPUT_BUFFER_PADDING_SIZE and set the memory to zero</div><div>2.  av_register_all();</div><div>3.  Create the codec and Codec Context for h264 and open it. <br></div><div>    - I Copy the extra data from the encoded frame to this context. </div><div>4. Allocate the memory for the frames (YUV and RGB) </div><div>5. First time using the coded I call decode - I see the codec context now has the correct values for height and width. </div><div>    - For decoding I use the avcodec_send_packet and check in a while loop for avcodec_receive_frame() I see the number of decoded frames in the codec context goes up (pCodecCtx->frame_number) </div><div>6. Use this codec context to set up the sws_context </div><div>7. Use the sws_context and the YUV frame decoded to get the RGB frame. </div><br class="gmail-Apple-interchange-newline"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Jimmy Bhaktha</div></div></div>