Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSasi Inguva <isasi@google.com>2018-05-30 01:36:07 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2018-06-06 02:53:30 +0300
commitfe6c4f0c47d4390bead6e226cb12b45584b76301 (patch)
tree3388b17ec15a6ef5d01e80859ec99fd26493805f /libavformat
parent318d0fcbfe5637013342d53d44bb7ea8867fb4d0 (diff)
lavf/mov.c: Set st->start_time for video streams explicitly.
If start_time is not set, ffmpeg takes the duration from the global movie instead of the per stream duration. Signed-off-by: Sasi Inguva <isasi@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mov.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index cab7247cc5..4ad19122b3 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3673,11 +3673,15 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
// If the minimum pts turns out to be greater than zero after fixing the index, then we subtract the
// dts by that amount to make the first pts zero.
- if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && msc->min_corrected_pts > 0) {
- av_log(mov->fc, AV_LOG_DEBUG, "Offset DTS by %"PRId64" to make first pts zero.\n", msc->min_corrected_pts);
- for (i = 0; i < st->nb_index_entries; ++i) {
- st->index_entries[i].timestamp -= msc->min_corrected_pts;
+ if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
+ if (msc->min_corrected_pts > 0) {
+ av_log(mov->fc, AV_LOG_DEBUG, "Offset DTS by %"PRId64" to make first pts zero.\n", msc->min_corrected_pts);
+ for (i = 0; i < st->nb_index_entries; ++i) {
+ st->index_entries[i].timestamp -= msc->min_corrected_pts;
+ }
}
+ // Start time should be equal to zero or the duration of any empty edits.
+ st->start_time = empty_edits_sum_duration;
}
// Update av stream length, if it ends up shorter than the track's media duration
@@ -4013,6 +4017,14 @@ static void mov_build_index(MOVContext *mov, AVStream *st)
mov_fix_index(mov, st);
}
+ // Update start time of the stream.
+ if (st->start_time == AV_NOPTS_VALUE && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && st->nb_index_entries > 0) {
+ st->start_time = st->index_entries[0].timestamp + sc->dts_shift;
+ if (sc->ctts_data) {
+ st->start_time += sc->ctts_data[0].duration;
+ }
+ }
+
mov_estimate_video_delay(mov, st);
}