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

Rodger Combs rodger.combs at gmail.com
Tue Sep 26 22:54:59 EEST 2017


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

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 92d398ab50..7ed48905f5 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -100,6 +100,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 struct codec_string {
@@ -785,6 +786,17 @@ static int dash_init(AVFormatContext *s)
             dict_set_int(&opts, "cluster_time_limit", c->min_seg_duration / 1000, 0);
             dict_set_int(&opts, "cluster_size_limit", 5 * 1024 * 1024, 0); // set a large cluster size limit
         }
+
+        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;
@@ -1190,6 +1202,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