[FFmpeg-devel] [PATCH 3/3 v2] avformat/movenc: set delay_moov flag when writing DASH
Martin Storsjö
martin at martin.st
Fri Nov 22 10:32:27 EET 2024
On Thu, 21 Nov 2024, James Almer wrote:
> Instead of expecting the DASH muxer manually setting this, just do it here.
> This is required to write a simple edit list for audio tracks with triming
> samples, where negative CTS offsets can't be used.
>
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> libavformat/movenc.c | 2 +-
> libavformat/tests/movenc.c | 6 +++---
> tests/ref/fate/movenc | 14 +++++++-------
> 3 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 7cdec28835..cc67e274e8 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -7641,7 +7641,7 @@ static int mov_init(AVFormatContext *s)
> FF_MOV_FLAG_FRAGMENT | FF_MOV_FLAG_NEGATIVE_CTS_OFFSETS;
> if (mov->flags & FF_MOV_FLAG_DASH)
> mov->flags |= FF_MOV_FLAG_FRAGMENT | FF_MOV_FLAG_EMPTY_MOOV |
> - FF_MOV_FLAG_DEFAULT_BASE_MOOF;
> + FF_MOV_FLAG_DEFAULT_BASE_MOOF | FF_MOV_FLAG_DELAY_MOOV;
> if (mov->flags & FF_MOV_FLAG_CMAF)
> mov->flags |= FF_MOV_FLAG_FRAGMENT | FF_MOV_FLAG_EMPTY_MOOV |
> FF_MOV_FLAG_DEFAULT_BASE_MOOF | FF_MOV_FLAG_NEGATIVE_CTS_OFFSETS;
I'm a little reluctant to do this; IIRC the delay_moov flag significantly
changes the sequence of what boxes gets output at what time, which affects
things for API users integrating this into segmentation setups. (I presume
that's why you changed the movenc test case as well?)
That's why I'd like to keep delay_moov an explicit opt-in - even if it
kinda is necessary to get the timing entirely correct. Users that don't
need it, and rely on getting the whole moov during avformat_write_header,
would be broken by this change.
// Martin
More information about the ffmpeg-devel
mailing list