From: Zhao Zhili <quinkblack@foxmail.com> To: ffmpeg-devel@ffmpeg.org Cc: Zhao Zhili <quinkblack@foxmail.com> Subject: [FFmpeg-devel] [PATCH] avformat/movenc: fix duration in mdhd box Date: Fri, 17 Dec 2021 21:34:09 +0800 Message-ID: <tencent_44A0555A2767B88B960E4D1AA02ECDF9CF07@qq.com> (raw) It's the duration of this media, should not take account of editlist. --- libavformat/movenc.c | 9 +++++++-- tests/ref/fate/movenc | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 0f912dd012..643beac6f2 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -2970,8 +2970,13 @@ static int64_t calc_pts_duration(MOVMuxContext *mov, MOVTrack *track) static int mov_write_mdhd_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track) { - int64_t duration = calc_pts_duration(mov, track); - int version = duration < INT32_MAX ? 0 : 1; + int64_t start, end; + int64_t duration; + int version; + + get_pts_range(mov, track, &start, &end); + duration = end - start; + version = duration < INT32_MAX ? 0 : 1; if (track->mode == MODE_ISM) version = 1; diff --git a/tests/ref/fate/movenc b/tests/ref/fate/movenc index 81ea75f372..19e4e291b8 100644 --- a/tests/ref/fate/movenc +++ b/tests/ref/fate/movenc @@ -7,7 +7,7 @@ write_data len 36, time nopts, type header atom ftyp write_data len 2761, time nopts, type header atom - write_data len 908, time 966667, type sync atom moof write_data len 110, time nopts, type trailer atom - -caf0876986b5f033efc0958c338289cc 3815 non-empty-moov-elst +9d260d424e9de4626163fd25ccce5bab 3815 non-empty-moov-elst write_data len 36, time nopts, type header atom ftyp write_data len 2669, time nopts, type header atom - write_data len 908, time 1000000, type sync atom moof -- 2.31.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2021-12-17 13:34 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-12-17 13:34 Zhao Zhili [this message] 2021-12-17 13:43 ` Martin Storsjö 2021-12-17 13:58 ` [FFmpeg-devel] [PATCH v3] " Zhao Zhili 2021-12-17 18:48 ` Martin Storsjö 2022-01-05 11:31 ` "zhilizhao(赵志立)" 2022-01-10 10:18 ` [FFmpeg-devel] [PATCH v4] " Zhao Zhili 2022-01-10 10:52 ` Martin Storsjö 2021-12-17 13:50 ` [FFmpeg-devel] [PATCH v2] " Zhao Zhili
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=tencent_44A0555A2767B88B960E4D1AA02ECDF9CF07@qq.com \ --to=quinkblack@foxmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git