[Libav-user] (no subject)
Jimmy Bhaktha
jimmy at accelrobotics.com
Mon Sep 24 22:25:49 EEST 2018
Hi
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.
When I feed it packets I see the following output
Creating the codec h264
Creating the codec context
[h264 @ 0x557a3846d880] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x557a3846d880] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x557a3846d880] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x557a3846d880] Reinit context to 2688x1520, pix_fmt: yuvj420p
avcodec_send_packet=0
avcodec_receive_frame=0, pCodecCtx->frame_number=1
[swscaler @ 0x557a385fdb20] bad src image pointers
avcodec_send_packet=0
avcodec_receive_frame=0, pCodecCtx->frame_number=2
[swscaler @ 0x557a385fdb20] bad src image pointers
I was wondering why the swscaler is complaining about bad src images.
Here is the sequence of calls in my code
1. av_packet_alloc() and av_packet_init()
- copy the encoded image to packet->data (I extend it by
AV_INPUT_BUFFER_PADDING_SIZE and set the memory to zero
2. av_register_all();
3. Create the codec and Codec Context for h264 and open it.
- I Copy the extra data from the encoded frame to this context.
4. Allocate the memory for the frames (YUV and RGB)
5. First time using the coded I call decode - I see the codec context now
has the correct values for height and width.
- 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)
6. Use this codec context to set up the sws_context
7. Use the sws_context and the YUV frame decoded to get the RGB frame.
--
Jimmy Bhaktha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20180924/77d0502b/attachment.html>
More information about the Libav-user
mailing list