[FFmpeg-devel] [PATCH 3/3 v2] avformat/movenc: set delay_moov flag when writing DASH
James Almer
jamrial at gmail.com
Fri Nov 22 14:43:07 EET 2024
On 11/22/2024 5:32 AM, Martin Storsjö wrote:
> 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?)
The changes in md5 hashes there are only the missing dash brand in the
output, afaict. I removed the dash flag (which is not what the test was
about anyway) to make sure delay_moov was not included in the test that
only wanted empty_moov.
>
> 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.
But who uses the mov muxer with the dash movflag on its own instead of
through the dash muxer, which explicitly enables delay_moov? afaik that
flag only ensures the brand is added.
Functionality wise it does nothing more than select other flags. Or
rather, it should only do that, right? And if it does not, whatever code
looks for it should be changed to look for the fragment flag instead.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241122/d2c4a14e/attachment.sig>
More information about the ffmpeg-devel
mailing list