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 immediately. --- libavformat/dashenc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 810ab22416..ea3c76b802 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -2271,6 +2271,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); -- 2.31.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".