mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-26 19:01:44 +02:00
lavf/mov: Change default to prefer TFDT time and allow for fallback to SIDX or TFDT
This commit is contained in:
parent
f6ab103bb5
commit
c42d513ede
@ -691,7 +691,7 @@ Don't use mfra box to set timestamps
|
||||
|
||||
@item use_tfdt
|
||||
For fragmented input, set fragment's starting timestamp to @code{baseMediaDecodeTime} from the @code{tfdt} box.
|
||||
Default is disabled, which will preferentially use the @code{earliest_presentation_time} from the @code{sidx} box.
|
||||
Default is enabled, which will prefer to use the @code{tfdt} box to set DTS. Disable to use the @code{earliest_presentation_time} from the @code{sidx} box.
|
||||
In either case, the timestamp from the @code{mfra} box will be used if it's available and @code{use_mfra_for} is
|
||||
set to pts or dts.
|
||||
|
||||
|
@ -4828,20 +4828,34 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
dts = frag_stream_info->first_tfra_pts;
|
||||
av_log(c->fc, AV_LOG_DEBUG, "found mfra time %"PRId64
|
||||
", using it for dts\n", pts);
|
||||
} else if (frag_stream_info->sidx_pts != AV_NOPTS_VALUE && !c->use_tfdt) {
|
||||
// FIXME: sidx earliest_presentation_time is *PTS*, s.b.
|
||||
// pts = frag_stream_info->sidx_pts;
|
||||
dts = frag_stream_info->sidx_pts - sc->time_offset;
|
||||
av_log(c->fc, AV_LOG_DEBUG, "found sidx time %"PRId64
|
||||
", using it for pts\n", pts);
|
||||
} else if (frag_stream_info->tfdt_dts != AV_NOPTS_VALUE) {
|
||||
dts = frag_stream_info->tfdt_dts - sc->time_offset;
|
||||
av_log(c->fc, AV_LOG_DEBUG, "found tfdt time %"PRId64
|
||||
", using it for dts\n", dts);
|
||||
} else {
|
||||
dts = sc->track_end - sc->time_offset;
|
||||
av_log(c->fc, AV_LOG_DEBUG, "found track end time %"PRId64
|
||||
", using it for dts\n", dts);
|
||||
int has_tfdt = frag_stream_info->tfdt_dts != AV_NOPTS_VALUE;
|
||||
int has_sidx = frag_stream_info->sidx_pts != AV_NOPTS_VALUE;
|
||||
int fallback_tfdt = !c->use_tfdt && !has_sidx && has_tfdt;
|
||||
int fallback_sidx = c->use_tfdt && !has_tfdt && has_sidx;
|
||||
|
||||
if (fallback_sidx) {
|
||||
av_log(c->fc, AV_LOG_DEBUG, "use_tfdt set but no tfdt found, using sidx instead\n");
|
||||
}
|
||||
if (fallback_tfdt) {
|
||||
av_log(c->fc, AV_LOG_DEBUG, "use_tfdt not set but no sidx found, using tfdt instead\n");
|
||||
}
|
||||
|
||||
if (has_tfdt && c->use_tfdt || fallback_tfdt) {
|
||||
dts = frag_stream_info->tfdt_dts - sc->time_offset;
|
||||
av_log(c->fc, AV_LOG_DEBUG, "found tfdt time %"PRId64
|
||||
", using it for dts\n", dts);
|
||||
} else if (has_sidx && !c->use_tfdt || fallback_sidx) {
|
||||
// FIXME: sidx earliest_presentation_time is *PTS*, s.b.
|
||||
// pts = frag_stream_info->sidx_pts;
|
||||
dts = frag_stream_info->sidx_pts - sc->time_offset;
|
||||
av_log(c->fc, AV_LOG_DEBUG, "found sidx time %"PRId64
|
||||
", using it for pts\n", pts);
|
||||
} else {
|
||||
dts = sc->track_end - sc->time_offset;
|
||||
av_log(c->fc, AV_LOG_DEBUG, "found track end time %"PRId64
|
||||
", using it for dts\n", dts);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dts = sc->track_end - sc->time_offset;
|
||||
@ -8533,7 +8547,7 @@ static const AVOption mov_options[] = {
|
||||
FLAGS, "use_mfra_for" },
|
||||
{"pts", "pts", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_MFRA_PTS}, 0, 0,
|
||||
FLAGS, "use_mfra_for" },
|
||||
{"use_tfdt", "use tfdt for fragment timestamps", OFFSET(use_tfdt), AV_OPT_TYPE_BOOL, {.i64 = 0},
|
||||
{"use_tfdt", "use tfdt for fragment timestamps", OFFSET(use_tfdt), AV_OPT_TYPE_BOOL, {.i64 = 1},
|
||||
0, 1, FLAGS},
|
||||
{ "export_all", "Export unrecognized metadata entries", OFFSET(export_all),
|
||||
AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, .flags = FLAGS },
|
||||
|
@ -23,10 +23,10 @@ ret: 0 st: 0 flags:0 dts: 126.666667 pts: 126.766667 pos:13428716 size:
|
||||
ret: 0 st: 0 flags:0 dts: 126.700000 pts: 126.700000 pos:13431630 size: 781
|
||||
ret: 0 st: 0 flags:0 dts: 126.733333 pts: 126.733333 pos:13432411 size: 817
|
||||
ret: 0 st:-1 flags:0 ts: 50.576668
|
||||
ret: 0 st: 0 flags:1 dts: 50.600000 pts: 50.633333 pos:5858254 size: 67903
|
||||
ret: 0 st: 0 flags:0 dts: 50.633333 pts: 50.733333 pos:5926157 size: 1307
|
||||
ret: 0 st: 0 flags:0 dts: 50.666667 pts: 50.666667 pos:5927464 size: 150
|
||||
ret: 0 st: 0 flags:0 dts: 50.700000 pts: 50.700000 pos:5927614 size: 176
|
||||
ret: 0 st: 0 flags:1 dts: 50.633333 pts: 50.666667 pos:5858254 size: 67903
|
||||
ret: 0 st: 0 flags:0 dts: 50.666667 pts: 50.766667 pos:5926157 size: 1307
|
||||
ret: 0 st: 0 flags:0 dts: 50.700000 pts: 50.700000 pos:5927464 size: 150
|
||||
ret: 0 st: 0 flags:0 dts: 50.733333 pts: 50.733333 pos:5927614 size: 176
|
||||
ret: 0 st:-1 flags:1 ts: 153.470835
|
||||
ret: 0 st: 0 flags:1 dts: 151.966667 pts: 152.000000 pos:15705355 size:146924
|
||||
ret: 0 st: 0 flags:0 dts: 152.000000 pts: 152.100000 pos:15852279 size: 1355
|
||||
@ -43,10 +43,10 @@ ret: 0 st: 0 flags:0 dts: 0.000000 pts: 0.033333 pos: 1470 size: 24
|
||||
ret: 0 st: 0 flags:0 dts: 0.033333 pts: 0.066667 pos: 1494 size: 6779
|
||||
ret: 0 st: 0 flags:0 dts: 0.066667 pts: 0.100000 pos: 8273 size: 11041
|
||||
ret: 0 st:-1 flags:0 ts: 102.153336
|
||||
ret: 0 st: 0 flags:1 dts: 104.066667 pts: 104.100000 pos:11116461 size:112929
|
||||
ret: 0 st: 0 flags:0 dts: 104.100000 pts: 104.133333 pos:11229390 size: 585
|
||||
ret: 0 st: 0 flags:0 dts: 104.133333 pts: 104.166667 pos:11229975 size: 797
|
||||
ret: 0 st: 0 flags:0 dts: 104.166667 pts: 104.200000 pos:11230772 size: 810
|
||||
ret: 0 st: 0 flags:1 dts: 104.100000 pts: 104.133333 pos:11116461 size:112929
|
||||
ret: 0 st: 0 flags:0 dts: 104.133333 pts: 104.166667 pos:11229390 size: 585
|
||||
ret: 0 st: 0 flags:0 dts: 104.166667 pts: 104.200000 pos:11229975 size: 797
|
||||
ret: 0 st: 0 flags:0 dts: 104.200000 pts: 104.233333 pos:11230772 size: 810
|
||||
ret: 0 st:-1 flags:1 ts: 25.047503
|
||||
ret: 0 st: 0 flags:1 dts: 20.233333 pts: 20.266667 pos:2223959 size: 51823
|
||||
ret: 0 st: 0 flags:0 dts: 20.266667 pts: 20.300000 pos:2275782 size: 488
|
||||
@ -58,10 +58,10 @@ ret: 0 st: 0 flags:0 dts: 131.266667 pts: 131.366667 pos:13790182 size:
|
||||
ret: 0 st: 0 flags:0 dts: 131.300000 pts: 131.300000 pos:13792531 size: 571
|
||||
ret: 0 st: 0 flags:0 dts: 131.333333 pts: 131.333333 pos:13793102 size: 1190
|
||||
ret: 0 st: 0 flags:1 ts: 50.835833
|
||||
ret: 0 st: 0 flags:1 dts: 50.600000 pts: 50.633333 pos:5858254 size: 67903
|
||||
ret: 0 st: 0 flags:0 dts: 50.633333 pts: 50.733333 pos:5926157 size: 1307
|
||||
ret: 0 st: 0 flags:0 dts: 50.666667 pts: 50.666667 pos:5927464 size: 150
|
||||
ret: 0 st: 0 flags:0 dts: 50.700000 pts: 50.700000 pos:5927614 size: 176
|
||||
ret: 0 st: 0 flags:1 dts: 50.633333 pts: 50.666667 pos:5858254 size: 67903
|
||||
ret: 0 st: 0 flags:0 dts: 50.666667 pts: 50.766667 pos:5926157 size: 1307
|
||||
ret: 0 st: 0 flags:0 dts: 50.700000 pts: 50.700000 pos:5927464 size: 150
|
||||
ret: 0 st: 0 flags:0 dts: 50.733333 pts: 50.733333 pos:5927614 size: 176
|
||||
ret: 0 st:-1 flags:0 ts: 153.730004
|
||||
ret: 0 st: 0 flags:1 dts: 157.033333 pts: 157.066667 pos:16225365 size: 82738
|
||||
ret: 0 st: 0 flags:0 dts: 157.066667 pts: 157.166667 pos:16308103 size: 2273
|
||||
@ -93,10 +93,10 @@ ret: 0 st: 0 flags:0 dts: 127.866667 pts: 127.966667 pos:13581454 size:
|
||||
ret: 0 st: 0 flags:0 dts: 127.900000 pts: 127.900000 pos:13584390 size: 451
|
||||
ret: 0 st: 0 flags:0 dts: 127.933333 pts: 127.933333 pos:13584841 size: 537
|
||||
ret: 0 st: 0 flags:0 ts: 51.095011
|
||||
ret: 0 st: 0 flags:1 dts: 52.033333 pts: 52.066667 pos:6028050 size:115809
|
||||
ret: 0 st: 0 flags:0 dts: 52.066667 pts: 52.166667 pos:6143859 size: 1620
|
||||
ret: 0 st: 0 flags:0 dts: 52.100000 pts: 52.100000 pos:6145479 size: 92
|
||||
ret: 0 st: 0 flags:0 dts: 52.133333 pts: 52.133333 pos:6145571 size: 533
|
||||
ret: 0 st: 0 flags:1 dts: 52.066667 pts: 52.100000 pos:6028050 size:115809
|
||||
ret: 0 st: 0 flags:0 dts: 52.100000 pts: 52.200000 pos:6143859 size: 1620
|
||||
ret: 0 st: 0 flags:0 dts: 52.133333 pts: 52.133333 pos:6145479 size: 92
|
||||
ret: 0 st: 0 flags:0 dts: 52.166667 pts: 52.166667 pos:6145571 size: 533
|
||||
ret: 0 st: 0 flags:1 ts: 153.989178
|
||||
ret: 0 st: 0 flags:1 dts: 153.466667 pts: 153.500000 pos:15867700 size: 96169
|
||||
ret: 0 st: 0 flags:0 dts: 153.500000 pts: 153.533333 pos:15963869 size: 785
|
||||
@ -113,10 +113,10 @@ ret: 0 st: 0 flags:0 dts: 0.000000 pts: 0.033333 pos: 1470 size: 24
|
||||
ret: 0 st: 0 flags:0 dts: 0.033333 pts: 0.066667 pos: 1494 size: 6779
|
||||
ret: 0 st: 0 flags:0 dts: 0.066667 pts: 0.100000 pos: 8273 size: 11041
|
||||
ret: 0 st: 0 flags:0 ts: 102.671678
|
||||
ret: 0 st: 0 flags:1 dts: 104.066667 pts: 104.100000 pos:11116461 size:112929
|
||||
ret: 0 st: 0 flags:0 dts: 104.100000 pts: 104.133333 pos:11229390 size: 585
|
||||
ret: 0 st: 0 flags:0 dts: 104.133333 pts: 104.166667 pos:11229975 size: 797
|
||||
ret: 0 st: 0 flags:0 dts: 104.166667 pts: 104.200000 pos:11230772 size: 810
|
||||
ret: 0 st: 0 flags:1 dts: 104.100000 pts: 104.133333 pos:11116461 size:112929
|
||||
ret: 0 st: 0 flags:0 dts: 104.133333 pts: 104.166667 pos:11229390 size: 585
|
||||
ret: 0 st: 0 flags:0 dts: 104.166667 pts: 104.200000 pos:11229975 size: 797
|
||||
ret: 0 st: 0 flags:0 dts: 104.200000 pts: 104.233333 pos:11230772 size: 810
|
||||
ret: 0 st: 0 flags:1 ts: 25.565844
|
||||
ret: 0 st: 0 flags:1 dts: 25.300000 pts: 25.333333 pos:2607246 size: 40273
|
||||
ret: 0 st: 0 flags:0 dts: 25.333333 pts: 25.433333 pos:2647519 size: 2959
|
||||
@ -128,7 +128,7 @@ ret: 0 st: 0 flags:0 dts: 131.266667 pts: 131.366667 pos:13790182 size:
|
||||
ret: 0 st: 0 flags:0 dts: 131.300000 pts: 131.300000 pos:13792531 size: 571
|
||||
ret: 0 st: 0 flags:0 dts: 131.333333 pts: 131.333333 pos:13793102 size: 1190
|
||||
ret: 0 st:-1 flags:1 ts: 51.354175
|
||||
ret: 0 st: 0 flags:1 dts: 50.600000 pts: 50.633333 pos:5858254 size: 67903
|
||||
ret: 0 st: 0 flags:0 dts: 50.633333 pts: 50.733333 pos:5926157 size: 1307
|
||||
ret: 0 st: 0 flags:0 dts: 50.666667 pts: 50.666667 pos:5927464 size: 150
|
||||
ret: 0 st: 0 flags:0 dts: 50.700000 pts: 50.700000 pos:5927614 size: 176
|
||||
ret: 0 st: 0 flags:1 dts: 50.633333 pts: 50.666667 pos:5858254 size: 67903
|
||||
ret: 0 st: 0 flags:0 dts: 50.666667 pts: 50.766667 pos:5926157 size: 1307
|
||||
ret: 0 st: 0 flags:0 dts: 50.700000 pts: 50.700000 pos:5927464 size: 150
|
||||
ret: 0 st: 0 flags:0 dts: 50.733333 pts: 50.733333 pos:5927614 size: 176
|
||||
|
Loading…
Reference in New Issue
Block a user