* [FFmpeg-devel] [PATCH] avformat/movenc: fix duration in mdhd box
@ 2021-12-17 13:34 Zhao Zhili
2021-12-17 13:43 ` Martin Storsjö
2021-12-17 13:50 ` [FFmpeg-devel] [PATCH v2] " Zhao Zhili
0 siblings, 2 replies; 8+ messages in thread
From: Zhao Zhili @ 2021-12-17 13:34 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
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".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avformat/movenc: fix duration in mdhd box
2021-12-17 13:34 [FFmpeg-devel] [PATCH] avformat/movenc: fix duration in mdhd box Zhao Zhili
@ 2021-12-17 13:43 ` Martin Storsjö
2021-12-17 13:58 ` [FFmpeg-devel] [PATCH v3] " Zhao Zhili
2021-12-17 13:50 ` [FFmpeg-devel] [PATCH v2] " Zhao Zhili
1 sibling, 1 reply; 8+ messages in thread
From: Martin Storsjö @ 2021-12-17 13:43 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Zhao Zhili
On Fri, 17 Dec 2021, Zhao Zhili wrote:
> 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;
Isn't this equal to what calc_samples_pts_duration() returns?
It'd be good to point out in the commit message, that
c2424b1f35a1c6c06f1f9fe5f77a7157ed84e1cd was incorrect in this
aspect. It'd also be good to really spell it out clearly, that (if I
understand it correctly), mvhd and tkhd should present the post-editlist
duration, while mdhd should have the pre-editlist duration?
// Martin
_______________________________________________
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".
^ permalink raw reply [flat|nested] 8+ messages in thread
* [FFmpeg-devel] [PATCH v2] avformat/movenc: fix duration in mdhd box
2021-12-17 13:34 [FFmpeg-devel] [PATCH] avformat/movenc: fix duration in mdhd box Zhao Zhili
2021-12-17 13:43 ` Martin Storsjö
@ 2021-12-17 13:50 ` Zhao Zhili
1 sibling, 0 replies; 8+ messages in thread
From: Zhao Zhili @ 2021-12-17 13:50 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
It's the duration of this media, should not take account of
editlist.
---
libavformat/movenc.c | 2 +-
tests/ref/fate/movenc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 0f912dd012..f76ef430cf 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2970,7 +2970,7 @@ 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);
+ int64_t duration = calc_samples_pts_duration(mov, track);
int version = duration < INT32_MAX ? 0 : 1;
if (track->mode == MODE_ISM)
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".
^ permalink raw reply [flat|nested] 8+ messages in thread
* [FFmpeg-devel] [PATCH v3] avformat/movenc: fix duration in mdhd box
2021-12-17 13:43 ` Martin Storsjö
@ 2021-12-17 13:58 ` Zhao Zhili
2021-12-17 18:48 ` Martin Storsjö
2022-01-10 10:18 ` [FFmpeg-devel] [PATCH v4] " Zhao Zhili
0 siblings, 2 replies; 8+ messages in thread
From: Zhao Zhili @ 2021-12-17 13:58 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
mvhd and tkhd present the post-editlist duration, while mdhd should
have the pre-editlist duration. Regression since c2424b1f3.
---
libavformat/movenc.c | 2 +-
tests/ref/fate/movenc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 0f912dd012..f76ef430cf 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2970,7 +2970,7 @@ 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);
+ int64_t duration = calc_samples_pts_duration(mov, track);
int version = duration < INT32_MAX ? 0 : 1;
if (track->mode == MODE_ISM)
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".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH v3] avformat/movenc: fix duration in mdhd box
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
1 sibling, 1 reply; 8+ messages in thread
From: Martin Storsjö @ 2021-12-17 18:48 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Zhao Zhili
On Fri, 17 Dec 2021, Zhao Zhili wrote:
> mvhd and tkhd present the post-editlist duration, while mdhd should
> have the pre-editlist duration. Regression since c2424b1f3.
> ---
> libavformat/movenc.c | 2 +-
> tests/ref/fate/movenc | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
Thanks, this looks sensible to me. I haven't verified these details with
the spec, but it sounds reasonable.
// Martin
_______________________________________________
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".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH v3] avformat/movenc: fix duration in mdhd box
2021-12-17 18:48 ` Martin Storsjö
@ 2022-01-05 11:31 ` "zhilizhao(赵志立)"
0 siblings, 0 replies; 8+ messages in thread
From: "zhilizhao(赵志立)" @ 2022-01-05 11:31 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: martin
> On Dec 18, 2021, at 2:48 AM, Martin Storsjö <martin@martin.st> wrote:
>
> On Fri, 17 Dec 2021, Zhao Zhili wrote:
>
>> mvhd and tkhd present the post-editlist duration, while mdhd should
>> have the pre-editlist duration. Regression since c2424b1f3.
>> ---
>> libavformat/movenc.c | 2 +-
>> tests/ref/fate/movenc | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> Thanks, this looks sensible to me. I haven't verified these details with the spec, but it sounds reasonable.
Ping. Is the patch Ok to be merged?
>
> // Martin
>
> _______________________________________________
> 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".
_______________________________________________
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".
^ permalink raw reply [flat|nested] 8+ messages in thread
* [FFmpeg-devel] [PATCH v4] avformat/movenc: fix duration in mdhd box
2021-12-17 13:58 ` [FFmpeg-devel] [PATCH v3] " Zhao Zhili
2021-12-17 18:48 ` Martin Storsjö
@ 2022-01-10 10:18 ` Zhao Zhili
2022-01-10 10:52 ` Martin Storsjö
1 sibling, 1 reply; 8+ messages in thread
From: Zhao Zhili @ 2022-01-10 10:18 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Zhao Zhili
mvhd and tkhd present the post-editlist duration, while mdhd should
have the pre-editlist duration. Regression since c2424b1f3.
---
v4: fix more fate
libavformat/movenc.c | 2 +-
tests/ref/fate/copy-trac3074 | 2 +-
tests/ref/fate/mov-cover-image | 2 +-
tests/ref/fate/mov-mp4-disposition-mpegts-remux | 2 +-
tests/ref/fate/movenc | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index ab33371296..4c868919ae 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2960,7 +2960,7 @@ 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);
+ int64_t duration = calc_samples_pts_duration(mov, track);
int version = duration < INT32_MAX ? 0 : 1;
if (track->mode == MODE_ISM)
diff --git a/tests/ref/fate/copy-trac3074 b/tests/ref/fate/copy-trac3074
index 4748296c2a..2ef7e702cd 100644
--- a/tests/ref/fate/copy-trac3074
+++ b/tests/ref/fate/copy-trac3074
@@ -1,4 +1,4 @@
-452d91e7c6889b787717fef25b6fce43 *tests/data/fate/copy-trac3074.mp4
+36fcc0a62695bcf93068fcfe68283ee9 *tests/data/fate/copy-trac3074.mp4
334016 tests/data/fate/copy-trac3074.mp4
#tb 0: 1/48000
#media_type 0: audio
diff --git a/tests/ref/fate/mov-cover-image b/tests/ref/fate/mov-cover-image
index 680d84e061..6141646afa 100644
--- a/tests/ref/fate/mov-cover-image
+++ b/tests/ref/fate/mov-cover-image
@@ -1,4 +1,4 @@
-4e92f776010bd7a727c11bf8c34cde1e *tests/data/fate/mov-cover-image.mp4
+54a8870d5d1e6cc4da28ae422aa70898 *tests/data/fate/mov-cover-image.mp4
1011919 tests/data/fate/mov-cover-image.mp4
#extradata 0: 2, 0x00340022
#tb 0: 1/44100
diff --git a/tests/ref/fate/mov-mp4-disposition-mpegts-remux b/tests/ref/fate/mov-mp4-disposition-mpegts-remux
index 78f1668f65..184b952e04 100644
--- a/tests/ref/fate/mov-mp4-disposition-mpegts-remux
+++ b/tests/ref/fate/mov-mp4-disposition-mpegts-remux
@@ -1,4 +1,4 @@
-3c4432fe59ffd9f2ed6ba4b122cea935 *tests/data/fate/mov-mp4-disposition-mpegts-remux.mp4
+adb3b95c07a5f3e0c86641dd62f01dae *tests/data/fate/mov-mp4-disposition-mpegts-remux.mp4
5709 tests/data/fate/mov-mp4-disposition-mpegts-remux.mp4
#tb 0: 1/48000
#media_type 0: audio
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".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH v4] avformat/movenc: fix duration in mdhd box
2022-01-10 10:18 ` [FFmpeg-devel] [PATCH v4] " Zhao Zhili
@ 2022-01-10 10:52 ` Martin Storsjö
0 siblings, 0 replies; 8+ messages in thread
From: Martin Storsjö @ 2022-01-10 10:52 UTC (permalink / raw)
To: FFmpeg development discussions and patches; +Cc: Zhao Zhili
On Mon, 10 Jan 2022, Zhao Zhili wrote:
> mvhd and tkhd present the post-editlist duration, while mdhd should
> have the pre-editlist duration. Regression since c2424b1f3.
> ---
> v4: fix more fate
Pushed this now, and backported it to 5.0 - sorry for the delay.
// Martin
_______________________________________________
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".
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-01-10 10:53 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 13:34 [FFmpeg-devel] [PATCH] avformat/movenc: fix duration in mdhd box Zhao Zhili
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
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