[FFmpeg-devel] [PATCH] movenc: Write durations based on pts into mvhd/mdhd/tkhd/elst
Martin Storsjö
martin at martin.st
Tue Dec 17 14:47:42 EET 2019
On Mon, 16 Dec 2019, Michael Niedermayer wrote:
> On Mon, Dec 16, 2019 at 12:16:14AM +0200, Martin Storsjö wrote:
>> Keep all the existing data fields as they are (there's lots and
>> lots of nontrivial calculation and heuristics based on them in
>> their current form), but derive the duration as the difference
>> between the pts of the first packet to the maximum pts+duration
>> (not necessarily the last packet); use this duration in any box
>> where the actual presentation duration is supposed to be.
>>
>> Fixes: 8420
>> ---
>> libavformat/movenc.c | 21 ++++++++++++++++-----
>> tests/ref/lavf/mov | 4 ++--
>> tests/ref/lavf/mp4 | 4 ++--
>> 3 files changed, 20 insertions(+), 9 deletions(-)
>
> This seems to loose duration for this: (not sure which way is more correct)
>
> ./ffmpeg -i ~/tickets/2892/MPEG_tbn_test.mov -c:v copy -c:a copy -vtag mx3n -timecode 10:00:00:00 -vframes 3 x.mov && ./ffprobe -v x.mov -show_packets -print_format compact
Thanks for testing. Seems like there's a special case for how
track_duration is updated for tmcd tracks, where it's updated based on
another track; I'll update the patch to fetch the effective duration for
that other track instead.
// Martin
More information about the ffmpeg-devel
mailing list