[FFmpeg-devel] [PATCH 3/4] fftools/ffmpeg_opt: add a stream_group_script option

James Almer jamrial at gmail.com
Sun Jan 7 23:30:59 EET 2024


Similar to filter_complex_script. Should make setting stream groups
easier.

Signed-off-by: James Almer <jamrial at gmail.com>
---
 fftools/ffmpeg_mux_init.c | 2 +-
 fftools/ffmpeg_opt.c      | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 80109df0ae..1b42ac9a1d 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -2301,7 +2301,7 @@ static int of_add_groups(Muxer *mux, const OptionsContext *o)
         char *str, *ptr = NULL;
         int ret = 0;
 
-        str = av_strdup(o->stream_groups.opt[i].u.str);
+        str = av_strireplace(o->stream_groups.opt[i].u.str, "\n", "");
         if (!str)
             return ret;
 
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 7ae1b55cf0..7347fcbd31 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -1508,6 +1508,9 @@ const OptionDef options[] = {
     { "stream_group",           OPT_TYPE_STRING, OPT_SPEC | OPT_OUTPUT,
         { .off = OFFSET(stream_groups) },
         "add stream group with specified streams and group type-specific arguments", "id=number:st=number..." },
+    { "stream_group_script",           OPT_TYPE_FILE, OPT_SPEC | OPT_OUTPUT,
+        { .off = OFFSET(stream_groups) },
+        "read stream group with specified streams and group type-specific arguments from a file", "filename" },
     { "dframes",                OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_PERFILE | OPT_EXPERT | OPT_OUTPUT | OPT_HAS_CANON,
         { .func_arg = opt_data_frames },
         "set the number of data frames to output", "number",
-- 
2.43.0



More information about the ffmpeg-devel mailing list