[FFmpeg-devel] [PATCH] avcodec/libjxldec: emit proper PTS to decoded AVFrame

Anton Khirnov anton at khirnov.net
Mon Dec 18 19:05:43 EET 2023


Quoting Leo Izen (2023-12-15 00:33:33)
> On 12/14/23 03:28, Anton Khirnov wrote:
> > This logic seems shady to me.
> 
> Which part, specifically? The animated logic, or the non-animated logic?

Aspects of both looked questionable to me (which doesn't necessarily
means it's wrong)

> > The decoder should mess with pts as little
> > as possible and whenever it can just copy the packet value to the frame.
> > Any codec-level timestamps should not be trusted.
> 
> In the case of animated JXL, codec-level timestamps are all that's 
> available because the only demuxer is jpegxl_anim, which doesn't 
> packetize the individual frames.

That may change in the future. And you shouldn't assume the caller is
necessarily using lavf for demuxing, if you can help it.

> > 
> > Now this does not work when a single packet decodes into multiple
> > frames, then you have to add increments of frame duration to the
> > original packet pts. But you should still preserve the original value as
> > the base - it might not start at 0.
> 
> I see what you're saying, but in the case where one packet decodes into 
> multiple frames in the non-animated stream, we don't have any way to 
> properly differentiate the PTS of those frames.

When does that happen?

And sure, I accept that when there's no other option you might have to
take some liberties. I'm just saying it should be done as little as
possible.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list