[FFmpeg-user] decoder changes avframe's pts/dts during decoding

Jake Eastwood cheloveck2.0 at gmail.com
Fri Jul 1 18:56:38 EEST 2022


while (ret >= 0) {

    AVFrame *frame = av_frame_alloc();
    ret = avcodec_receive_frame(context_, frame);

    if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {

        // at some point it breaks here at once without any successes

        break;
    }

........
}


пт, 1 июл. 2022 г. в 21:51, Jake Eastwood <cheloveck2.0 at gmail.com>:

>  I have a stream that has correct input pts/dts packet order. By 'correct'
> I mean all pts >= dts and dts is monotonically increasing. From some point
> I start to decode that stream from key_packet. And to validate result
> before muxing it again, I check pts/pkt_dts of AVFrame again.
>
> It happens when at some point next packet didn't produce any frames
> without errors. And with next packet my next frame's "pts" can't keep up
> with "pkt_dts"
>
> while (ret >= 0) {
>     AVFrame *frame = av_frame_alloc();
>     ret = avcodec_receive_frame(context_, frame);
>
>     if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {
>         break;
>     }
>
> }
>
>
>  And my pts became less than pkt_dts. Example:
>  source pts/dts: 255600/255600  decoded pts/dts 252000 255600 type: P
>  source pts/dts: 259200/259200  decoded pts/dts 255600 259200 type: P
>  source pts/dts: 262800/262800  decoded pts/dts 259200 262800 type: P
>  source pts/dts: 266400/266400  decoded pts/dts 262800 266400 type: P
>
>  I drop this avframe because mixer won't consume it anyways as I checked.
>  So why pts became bigger. What checks I really have to do to ensure
> correctness of frames?
>
>


More information about the ffmpeg-user mailing list