Opened 6 months ago

Last modified 6 months ago

#10681 new enhancement

dvdsubdec: use pts of initial packet

Reported by: valverde Owned by:
Priority: normal Component: avcodec
Version: unspecified Keywords: dvdsubdec
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

The pts is only returned with the first packet, while the subtitle is usually still incomplete. Repeating the pts with the completed subtitle would be helpful.
The function called is avcodec_decode_subtitle2 and it concerns at least dvd subtitles.

I stumbled upon this through handbrake no longer handling dvd subtitles well in debian bookworm. This lead me to https://github.com/HandBrake/HandBrake/blob/master/contrib/ffmpeg/A07-dvdsubdec-use-pts-of-initial-packet.patch which saves the pts for incomplete subtitles and returns it with the completed subtitle (when all packets were processed). Seems like a generally useful feature to me, not only for handbrake. I didn't find any discussion on this topic yet.

Change History (2)

comment:1 by Balling, 6 months ago

That makes no sense. It is obvious that is there is no PTS you need to look at last packet with PTS.

comment:2 by valverde, 6 months ago

Yes it's straight forward. But I guess every dvd sub user of that function has to implement that. Sounds like something a library could take care of for convenience. So I thought why not ffmpeg itself, as decode subtitle evidently already has internal state.
But I have no knowledge of the conventions or principles of ffmpeg so please excuse me for this naive question.
Maybe add a sentence to the documentation of decode subtitle to make it clear?

Note: See TracTickets for help on using tickets.