Opened 16 months ago
Closed 10 months ago
#11447 closed defect (fixed)
ffpreset functionality does not work as advertised
| Reported by: | Marth64 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | ffmpeg |
| Version: | git-master | Keywords: | |
| Cc: | MasterQuestionable | Blocked By: | |
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
Summary of the bug:
Note this section of the docs:
For the vpre, apre, and spre options, the options specified in a preset file are applied to the currently selected codec of the same type as the preset option.
Given the following:
- A video and audio source
- Video and audio encoders which take an option with the same name, such as "profile" (in this example we will use libx264 and libfdk_aac)
- Create an ffpreset file libx264-buggy.ffpreset in ~/.ffmpeg or $FFMPEG_DATADIR, with this content:
vcodec=libx264 profile=high
How to reproduce:
Now run
ffmpeg \
-y \
-ss 860 -t 360 \
-i INPUT.mkv \
-map 0:v:0 \
-bsf:0 "filter_units=remove_types=6" \
-filter:0 "bwdif=1,crop=516:469:94:11,scale=528:480:lanczos,setdar=4/3" \
-vpre:0 "libx264-buggy" \
-map 0:a:0 \
-c:1 libfdk_aac \
-ac:1 2 \
-ar:1 44100 \
-b:1 256k \
-map_metadata -1 \
OUTPUT.mkv
And observe that the profile option was picked up by the audio encoder instead, causing an abort.
ffmpeg version N-118421-g774f36756a Copyright (c) 2000-2025 the FFmpeg developers
built with gcc 13 (Ubuntu 13.3.0-6ubuntu2~24.04)
configuration: --enable-debug=3 --enable-ffplay --enable-gpl --enable-nonfree --enable-ffnvcodec --enable-vulkan --enable-libx264 --enable-libfdk_aac --enable-openssl --enable-version3 --enable-demuxer=dvdvideo --enable-libdvdread --enable-libdvdnav --samples=fate-suite/
libavutil 59. 56.100 / 59. 56.100
libavcodec 61. 32.100 / 61. 32.100
libavformat 61. 9.106 / 61. 9.106
libavdevice 61. 4.100 / 61. 4.100
libavfilter 10. 9.100 / 10. 9.100
libswscale 8. 13.100 / 8. 13.100
libswresample 5. 4.100 / 5. 4.100
libpostproc 58. 4.100 / 58. 4.100
Input #0, matroska,webm, from 'INPUT.mkv':
Metadata:
ENCODER : Lavf61.9.106
Duration: 00:23:36.70, start: 0.000000, bitrate: 5189 kb/s
Stream #0:0(eng): Video: mpeg2video (Main), yuv420p(tv, smpte170m, top first), 720x480 [SAR 8:9 DAR 4:3], 29.97 fps, 29.97 tbr, 1k tbn (default) (original)
Metadata:
title : en-US
DURATION : 00:23:36.248000000
Side data:
cpb: bitrate max/min/avg: 9800000/0/0 buffer size: 1835008 vbv_delay: N/A
Stream #0:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default) (original)
Metadata:
title : en-US
DURATION : 00:23:36.695000000
[libfdk_aac @ 0x62e1b4c91200] [Eval @ 0x7fff1ac2dae0] Undefined constant or missing '(' in 'high'
[libfdk_aac @ 0x62e1b4c91200] Unable to parse option value "high"
[libfdk_aac @ 0x62e1b4c91200] Error setting option profile to value high.
[aost#0:1/libfdk_aac @ 0x62e1b4c90ac0] Error applying encoder options: Invalid argument
Error opening output file OUTPUT.mkv.
Error opening output files: Invalid argument
Change History (3)
comment:1 by , 16 months ago
| Cc: | added |
|---|---|
| Component: | undetermined → ffmpeg |
| Version: | unspecified → git-master |
comment:2 by , 16 months ago
Looks like the options inside the preset are not inheriting the stream specifiers from the parent. Ideally if you use -preset:v foo.ffpreset then options set in foo.ffpreset should also inherit the stream specifiers, e.g. codec:v and profile:v. The only reason it didn't hard error on vcodec is that vcodec is simply an alias for codec:v.
comment:3 by , 10 months ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Fixed by 11a89bfe7bedc88980a178c565cc4d237e1ba0d8.



͏ Haven't ever used...
͏ Also feels like over-complexity.
͏ Recommendation is to avoid.