diff options
authorwm4 <wm4@nowhere>2020-02-27 22:29:40 +0100
committerwm4 <wm4@nowhere>2020-02-27 22:30:46 +0100
commit05564af1ac22fcea080c6f8bb993744a1a4cadd6 (patch)
parentb56e2efd5f3d2ed5e62fe02acdaedef03b2d2fbc (diff)
demux_mkv: document probe-start-time option and enable it by default
This is useful with live streams, and it's not much worse than the h264 first packet hack, which reads some data anyway. For some reason, the option wasn't even documented, so do that. In addition, print the start time even if it's negative. That should not be possible, but for some reason, the field is an int64_t copied from an uint64_t so... whatever. Keeping the logging slightly more straight forward is better anyway.
2 files changed, 8 insertions, 1 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index 6e2dc5498a..74a623e6c5 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -3406,6 +3406,12 @@ Demuxer
See ``--demuxer-mkv-subtitle-preroll``.
+ Check the start time of Matroska files (default: yes). This simply reads the
+ first cluster timestamps and assumes it is the start time. Technically, this
+ also reads the first timestamp, which may increase latency by one frame
+ (which may be relevant for live streams).
When opening the file, seek to the end of it, and check what timestamp the
last video packet has, and report that as file duration. This is strictly
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index 99e481bc7d..a65afbfbc5 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -244,6 +244,7 @@ const struct m_sub_options demux_mkv_conf = {
.subtitle_preroll = 2,
.subtitle_preroll_secs = 1.0,
.subtitle_preroll_secs_index = 10.0,
+ .probe_start_time = 1,
@@ -3211,7 +3212,7 @@ static void probe_first_timestamp(struct demuxer *demuxer)
demuxer->start_time = mkv_d->cluster_tc / 1e9;
- if (demuxer->start_time > 0)
+ if (demuxer->start_time)
MP_VERBOSE(demuxer, "Start PTS: %f\n", demuxer->start_time);