[FFmpeg-devel] [PATCH] mov: fix decode of fragments that overlap in time

Carl Eugen Hoyos ceffmpeg at gmail.com
Mon Sep 25 23:12:36 EEST 2017


2017-09-25 19:10 GMT+02:00 John Stebbins <jstebbins at jetheaddev.com>:
> When keyframe intervals of dash segments are not perfectly aligned,
> fragments in the stream can overlap in time. Append new "trun" index
> entries to the end of the index instead of sorting by timestamp.
> Sorting by timestamp causes packets to be read out of decode order and
> results in decode errors.
> ---
>  libavformat/mov.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 2519707345..b2bc7c2c3d 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -4339,8 +4339,8 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>                                    MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES));
>          if (keyframe)
>              distance = 0;
> -        ctts_index = av_add_index_entry(st, offset, dts, sample_size, distance,
> -                                        keyframe ? AVINDEX_KEYFRAME : 0);
> +        ctts_index = add_index_entry(st, offset, dts, sample_size, distance,
> +                                     keyframe ? AVINDEX_KEYFRAME : 0);

I can confirm that this fixes playback with FFplay but it shows
many warnings (Non-monotonous DTS) with ffmpeg: Is this
unavoidable?

Thank you, Carl Eugen


More information about the ffmpeg-devel mailing list