[FFmpeg-devel] [PATCH] lavf/dashenc: add format_options option, mirroring segment.c

Rodger Combs rodger.combs at gmail.com
Tue Sep 26 04:52:02 EEST 2017


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

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 6471649eb7..5e5bea54c4 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -90,6 +90,7 @@ typedef struct DASHContext {
     AVRational min_frame_rate, max_frame_rate;
     int ambiguous_frame_rate;
     const char *utc_timing_url;
+    const char *format_options_str;
 } DASHContext;
 
 static int dash_write(void *opaque, uint8_t *buf, int buf_size)
@@ -551,6 +552,17 @@ static int dash_init(AVFormatContext *s)
         os->init_start_pos = 0;
 
         av_dict_set(&opts, "movflags", "frag_custom+dash+delay_moov", 0);
+
+        if (c->format_options_str) {
+            ret = av_dict_parse_string(&opts, c->format_options_str, "=", ":", 0);
+            if (ret < 0) {
+                av_log(s, AV_LOG_ERROR, "Could not parse format options list '%s'\n",
+                       c->format_options_str);
+                av_dict_free(&opts);
+                return ret;
+            }
+        }
+
         if ((ret = avformat_init_output(ctx, &opts)) < 0)
             return ret;
         os->ctx_inited = 1;
@@ -945,6 +957,7 @@ static const AVOption options[] = {
     { "init_seg_name", "DASH-templated name to used for the initialization segment", OFFSET(init_seg_name), AV_OPT_TYPE_STRING, {.str = "init-stream$RepresentationID$.m4s"}, 0, 0, E },
     { "media_seg_name", "DASH-templated name to used for the media segments", OFFSET(media_seg_name), AV_OPT_TYPE_STRING, {.str = "chunk-stream$RepresentationID$-$Number%05d$.m4s"}, 0, 0, E },
     { "utc_timing_url", "URL of the page that will return the UTC timestamp in ISO format", OFFSET(utc_timing_url), AV_OPT_TYPE_STRING, { 0 }, 0, 0, E },
+    { "format_options", "set list of options for the underlying mp4 muxer", OFFSET(format_options_str), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E },
     { NULL },
 };
 
-- 
2.14.1



More information about the ffmpeg-devel mailing list