[FFmpeg-devel] [PATCH] dashenc: Write out DASH manifest immediately in streaming mode

Kevin LaFlamme kevin at aiera.com
Tue Jun 8 22:24:01 EEST 2021


For streaming mode with fragmented MP4 the intention is to have the client read a partial file since it’s broken up into sequential boxes that are playable independently. This doesn’t change the segment files themselves or how they are written, it just writes a full index file ahead of time.

Even currently, the manifest gets written after the first segment is written and the player can immediately attempt to start reading the second segment before it’s fully written.

This is the same thing that the “-lhls” is doing in the block below, writing out the HLS manifest immediately so that it contains X-EXT-PREFETCH fields for the partial segment files.

Currently, if you have a low latency DASH stream with “-ldash” and “-streaming” and the player joins in the middle of the stream everything works and it starts playing from the middle of the current segment. This means even with 10 second segments you can have latency < 1sec of the live edge. However, this doesn’t work for the very first segment because the manifest isn’t available to the player yet.

I have a low-latency player where I’m seeing this issue right now and this addresses the problem, and seems consistent with the “-lhls” handling below, but happy to make changes if there is something else I’m missing.

Kevin LaFlamme
Director of Engineering (Front End)
774.265.0382 (m)
aiera.com
On Jun 8, 2021, 3:10 PM -0400, Timo Rothenpieler <timo at rothenpieler.org>, wrote:
> On 08.06.2021 21:03, Kevin LaFlamme wrote:
> > When streaming mode is enabled with fMP4/CMAF for DASH output, the
> > segment files are available to read by players as soon as the first byte
> > is written instead of only after the file is fully written. The DASH
> > manifest currently only gets written when the final write to the segment
> > file occurs. This means that players cannot stream the first segment
> > while it is being written.
>
> Is this really a good idea?
> Imagine the files are being served by a http server.
> The server will stat() the file, and then send that size to the client
> in the HTTP headers.
> If now a Client reads that file way early, it will receive an incomplete
> version of the file. HTTP servers don't typically are capable of
> streaming files that are actively being written to.
>
> Reading a file while it's being written to is also not sensible possible
> or behaves in potentially unexpected ways, depending on the OS.
>
> > When -lhls is enabled with MP4 segments the HLS manifest is written
> > immediately to advertise the in-flight segments. This change adds the
> > same behavior for the DASH manifest so players can stream it
> > immediately.
>
>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list