[FFmpeg-devel] [PATCH] ffmpeg: Preserve input subtitle packet duration.
philipl at overt.org
Sun Sep 2 01:03:59 CEST 2012
On Sat, 1 Sep 2012 23:50:24 +0200
Nicolas George <nicolas.george at normalesup.org> wrote:
> I am sorry, but it seems completely wrong to me. In particular, it
> completely undoes the work of the fix_sub_duration option. It will
> also break when the duration is encoded in the subtitle bitstream and
> not in the format bitstream, like in DVD subtitles.
A fair point with respect to fix_sub_duration. I can account for that.
And yes, it does nothing for inband timing, but that was always true -
remember that until a few months ago, ffmpeg.c didn't propagate
the packet duration at all, and you lost duration information if it was
not already in-band. ie: We always relied on the fact that inband timing
stayed inband all the way through the pipeline.
> Can you show examples bad behaviours you are trying to fix?
Let's say I have an input sample that looks like this:
00:00:03,056 --> 00:00:04,740
So it has pts 3056 and duration 1684.
These get rescaled to 1/100 values associated with the ass format
subtitles: 306 and 168.
Then we try and construct the output sample. As we carry the pts
value through, it uses 3056, but the current duration code takes
the AVSubtitle value and rescales it back as 1680.
Now we've lost that 0.0004, which isn't a big deal from a user
perception point of view, but messes up correctness, especially
when we've got back-to-back subtitles.
I can account for fix_sub_duration by additionally applying
the correction to the pass-through duration value.
More information about the ffmpeg-devel