[Libav-user] frame->pts out-of-order when decode hevc

KIM daniel.morandini at keepinmind.info
Tue Oct 24 19:32:20 EEST 2023

Hi Carl,
> My parameters are as follows:
> (AVCodecContext*) pCodecContext->pix_fmt = AV_PIX_FMT_YUV420P;
> AV_PIX_FMT_YUV420P is the default parameter when code_id is AV_CODEC_ID_HEVC and it is one of raw format. So I think the order of frame I get from "avcodec_receive_frame(pCodecContext, pFrame);" is PTS and when I try to display the frame recieved, it can display properly. But its frame->pts is still not incremental.
> I tried to set the pix_fmt to AV_PIX_FMT_NV12, but it doesn't work. The pix_fmt still change back to AV_PIX_FMT_YUV420P.
> Do I set the wrong pix_fmt so that the it doesn't decode to the specific raw format?
I am not familiar with these formats. What I do in this cases is
* take deeper look into the examples [1]
* debug frame by frame
* create a test case using the `ffprobe -show_packets` command on an expected output file and compare them to the packets my code is producing

I am not a libav expert so this is how far I can go. Hope it helps.


[1] https://ffmpeg.org/doxygen/trunk/examples.html

More information about the Libav-user mailing list