* [FFmpeg-devel] [PATCH 0/1] Fix option parsing in ffpreset files @ 2025-07-19 9:35 Andreas Hartmann 2025-07-19 9:35 ` [FFmpeg-devel] [PATCH 1/1] ffmpeg_opt: Parse regular options in `ffpreset` files Andreas Hartmann 0 siblings, 1 reply; 2+ messages in thread From: Andreas Hartmann @ 2025-07-19 9:35 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Andreas Hartmann I recently hit an issue when trying to use 'ffpreset' files and I think it's a bug. I'm working on a set of options for transcoding videos for personal use. The CLI has become pretty long by now so I wanted to factor these options out into a ffpreset files along with comments that explain what the options do and why I chose those particular values over others. The key-part of my preset file looked like this: ```text vcodec=libsvtav1 pix_fmt=+yuv420p10le ``` When invoking it like this: ```bash ffmpeg -i SAMPLE.mkv -fpre ./my.ffpreset OUTPUT.mkv ``` I consistently got the following error: ``` ./default.ffpreset: Invalid option or argument: 'pix_fmt=+yuv420p10le ', parsed as 'pix_fmt' = '+yuv420p10le' ``` Which puzzled me quite a bit. I agree that `pix_fmt` is not a codec-specific option but I was still expecting it to work since it has an influence on the video after all. While searching for answers I found [#1530][1] which confirmed my suspicion. In the end I decided to take a look at the code and I discovered that `ffpreset` files, at the moment, only parse `AVOption`s (at least to my understanding), next to bare video/audio/subtitle/data codecs. So I've gone ahead and changed this. I had a look at the man page and that doesn't state anything about *what* kind of option is allowed to go into a `ffpreset` file. If there is any documentation you'd like me to update, or if you'd like to see tests for this, please let me know. I ran `make fate` locally and it passed at least. Kind regards hartan [1]: https://trac.ffmpeg.org/ticket/1530 Andreas Hartmann (1): ffmpeg_opt: Parse regular options in `ffpreset` files fftools/ffmpeg_opt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 2+ messages in thread
* [FFmpeg-devel] [PATCH 1/1] ffmpeg_opt: Parse regular options in `ffpreset` files 2025-07-19 9:35 [FFmpeg-devel] [PATCH 0/1] Fix option parsing in ffpreset files Andreas Hartmann @ 2025-07-19 9:35 ` Andreas Hartmann 0 siblings, 0 replies; 2+ messages in thread From: Andreas Hartmann @ 2025-07-19 9:35 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Andreas Hartmann instead of only AV-specific options. The previous code assumed that any option not defining the codec in an `ffpreset` file is an AVOption. This for example prevented the use of options defined in `OptionDef[]`, like `-pix_fmt`, as part of preset files, requiring users to type these out every time. Closes: #1530 Signed-off-by: Andreas Hartmann <hartan@7x.de> --- fftools/ffmpeg_opt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git (-)/fftools/ffmpeg_opt.c (+)/fftools/ffmpeg_opt.c index d714a152..926a8bda 100644 --- (-)/fftools/ffmpeg_opt.c +++ (+)/fftools/ffmpeg_opt.c @@ -1050,7 +1050,8 @@ static int opt_preset(void *optctx, const char *opt, const char *arg) else if (!strcmp(key, "vcodec")) opt_video_codec (o, key, value); else if (!strcmp(key, "scodec")) opt_subtitle_codec(o, key, value); else if (!strcmp(key, "dcodec")) opt_data_codec (o, key, value); - else if (opt_default_new(o, key, value) < 0) { + else if ((parse_option(o, key, value, options) < 0) && + (opt_default_new(o, key, value) < 0)) { av_log(NULL, AV_LOG_FATAL, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, key, value); ret = AVERROR(EINVAL); _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-19 9:46 UTC | newest] Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2025-07-19 9:35 [FFmpeg-devel] [PATCH 0/1] Fix option parsing in ffpreset files Andreas Hartmann 2025-07-19 9:35 ` [FFmpeg-devel] [PATCH 1/1] ffmpeg_opt: Parse regular options in `ffpreset` files Andreas Hartmann
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git