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

周 良军 zhouliangjun at live.com
Tue Oct 24 19:16:22 EEST 2023

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?

Thank you for for your last answer,

发件人: Libav-user <libav-user-bounces at ffmpeg.org> 代表 KIM via Libav-user <libav-user at ffmpeg.org>
发送时间: 2023年10月23日 13:02
收件人: This list is about using libavcodec, libavformat, libavutil, libavdevice and libavfilter. <libav-user at ffmpeg.org>
抄送: KIM <daniel.morandini at keepinmind.info>
主题: Re: [Libav-user] frame->pts out-of-order when decode hevc

> hello, everyone. this is my first time to use mail list.
Hi! This is my first reply instead.

> the set of pkt->pts is 0,1,2,3,4,5...
> bus the frame->pts received is 0,1,4,5,3,6,2 where the pict_type is I, I, B, B, B, B, P...
> why the frame->pts is not 0,1,2,3,4,5…
PTS (presentation time stamp) tells you the order at which frames should be presented, which is not always the same as the order at which frames should be decoded! That’s the DTS field (decoding time stamp). After decoding to some raw format, you’ll see that PTS are sorted as you expect.

Basically what you’re seeing is the way it is supposed to be! I hope it clarifies your doubt.


> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://jpn01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fffmpeg.org%2Fmailman%2Flistinfo%2Flibav-user&data=05%7C01%7C%7C91facdfa6525428daea808dbd3c869ab%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638336629966421037%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=AObH0aA5PTGBVj1hiO4GirMtfx%2BWCxaHn3c0%2F2tvNVI%3D&reserved=0<https://ffmpeg.org/mailman/listinfo/libav-user>
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".

Libav-user mailing list
Libav-user at ffmpeg.org

To unsubscribe, visit link above, or email
libav-user-request at ffmpeg.org with subject "unsubscribe".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20231024/0049ba94/attachment.htm>

More information about the Libav-user mailing list