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

Kevin LaFlamme git at videolan.org
Mon Jun 14 19:20:35 EEST 2021

ffmpeg | branch: master | Kevin LaFlamme <kevin at aiera.com> | Tue Jun  8 15:03:43 2021 -0400| [7d1464721ebf5c90308e48cb81ad52dbada47c18] | committer: Karthick J

dashenc: Write out DASH manifest immediately in streaming mode

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.

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

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7d1464721ebf5c90308e48cb81ad52dbada47c18

 libavformat/dashenc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index b7622bc09d..e7a4a3d9e1 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -2257,6 +2257,14 @@ static int dash_write_packet(AVFormatContext *s, AVPacket *pkt)
         if (ret < 0) {
             return handle_io_open_error(s, ret, os->temp_path);
+        // in streaming mode, the segments are available for playing
+        // before fully written but the manifest is needed so that
+        // clients and discover the segment filenames.
+        if (c->streaming && os->segment_type == SEGMENT_TYPE_MP4) {
+            write_manifest(s, 0);
+        }
         if (c->lhls) {
             char *prefetch_url = use_rename ? NULL : os->filename;
             write_hls_media_playlist(os, s, pkt->stream_index, 0, prefetch_url);

More information about the ffmpeg-cvslog mailing list