[FFmpeg-devel] [PATCH v3 2/2] avformat/movenc: sidx earliest_presentation_time is applied after editlist

"zhilizhao(赵志立)" quinkblack at foxmail.com
Thu Apr 28 14:21:37 EEST 2022



> On Mar 29, 2022, at 12:50 PM, Zhao Zhili <quinkblack at foxmail.com> wrote:
> 
> Fix #8334
> ---
> libavformat/movenc.c  |  6 +++++-
> tests/ref/fate/movenc | 10 +++++-----
> 2 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 46d66c29c2..079fc70d4a 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -4753,7 +4753,8 @@ static int mov_write_sidx_tag(AVIOContext *pb,
> 
>     if (track->entry) {
>         entries = 1;
> -        presentation_time = track->cluster[0].dts + track->cluster[0].cts;
> +        presentation_time = track->cluster[0].dts + track->cluster[0].cts -
> +                            track->start_dts - track->start_cts;
>         duration = track->end_pts -
>                    (track->cluster[0].dts + track->cluster[0].cts);
>         starts_with_SAP = track->cluster[0].flags & MOV_SYNC_SAMPLE;
> @@ -4768,6 +4769,9 @@ static int mov_write_sidx_tag(AVIOContext *pb,
>         if (entries <= 0)
>             return 0;
>         presentation_time = track->frag_info[0].time;
> +        /* presentation_time <= 0 is handled by mov_add_tfra_entries() */
> +        if (presentation_time > 0)
> +            presentation_time -= track->start_dts + track->start_cts;
>     }
> 
>     avio_wb32(pb, 0); /* size */

Will apply tomorrow. The issue in ticket 8334 has been hidden by the
use_tfdt flag, which ignored sidx timestamp. The real issue is in mp4 muxer.




More information about the ffmpeg-devel mailing list