[FFmpeg-devel] [PATCH 2/3] lavf/srtdec: Permit streaming input

Tomas Härdin git at haerdin.se
Sat Mar 30 16:44:02 EET 2024


lör 2024-03-30 klockan 12:44 +0100 skrev Nicolas George:
> Tomas Härdin (12024-03-30):
> > More interesting is fate-sub-srt-badsyntax. Despite the name it
> > doesn't
> > really have bad syntax, but its cues are in a random order. I guess
> > it
> > exists to test the cue sorting logic. But should subtitle demuxers
> > really sort subtitles in this way? We don't do that for other
> > formats
> > that can have non-decreasing timestamps. For comparison, the WebVTT
> > spec explicitly disallows decreasing timestamps.
> 
> On the other hand, I remember seeing a lot of ASS files from the
> fansub
> world where titles, signs and karaokes are added at the end after the
> dialogues, relying on sorting by the player.

Players can implement sorting if they wish. Why should we misrepresent
what the file says? These people could also fix their workflows, put
karaoke lyrics in a separate stream etc.. Business logic does not
belong in lavf, and certainly not deep within demuxers.

> (But I guess in the New and Improved FFmpeg, files originating from
> the
> fansub world are not worth our time, it is enough to be able to
> decode
> files for Crunchyroll…)

Snark doesn't help your case.

One potential solution is to do this style of parsing when the input is
non-seekable. But then we have the silly situation where streamed and
non-streamed behavior differs considerably.

Another way could be to move the sorting further up, into demux.c or
so, extending the generic index functionality.

Finally I will note that sorting does not happen when subtitles are
muxed in say mkv or avi, so the behavior is not even consistent across
demuxers that support subtitles. With logic further up, and proper
discarding, sorting could be done there as well.

/Tomas


More information about the ffmpeg-devel mailing list