I was studying the ffpresets and avpresets but I stumbled upon something interesting.
According to the ffmpeg docs:
First ffmpeg searches for a file named codec_name-arg.avpreset in the above-mentioned directories, where codec_name is the name of the codec to which the preset file options will be applied. For example, if you select the video codec with -vcodec libvpx and use -pre 1080p, then it will search for the file libvpx-1080p.avpreset.
If no such file is found, then ffmpeg will search for a file named arg.avpreset in the same directories.
I have a preset stored in the correct directory:
$ ls ~/.avconv/
libvpx-1080p.avpreset
Therefore, the following command should work:
$ ffmpeg -i input.mp4 -vcodec libvpx -pre 1080p output.mp4
But instead it results in the follwing error:
Preset 1080p specified for stream 0:1, but could not be opened.
However, the following command works:
ffmpeg -i input.mp4 -vcodec libvpx -pre libvpx-1080p output.mp4
Is this a bug or am I misunderstanding the docs?
EDIT: I originally tried with the latest ffmpeg version available from the repositories (4.3.1). However, I then decided to confirm this is still the case with the latest version built from source, which yields:
~/Downloads/FFmpeg$ ./ffmpeg --version
ffmpeg version N-102649-g3ac7d99428 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10 (Ubuntu 10.2.0-13ubuntu1)
configuration: --disable-x86asm --enable-libvpx
libavutil 57. 0.100 / 57. 0.100
libavcodec 59. 1.100 / 59. 1.100
libavformat 59. 2.101 / 59. 2.101
libavdevice 59. 0.100 / 59. 0.100
libavfilter 8. 0.101 / 8. 0.101
libswscale 6. 0.100 / 6. 0.100
libswresample 4. 0.100 / 4. 0.100
EDIT 2: Adding the whole log of the failing command as requested
$ ./ffmpeg -i ../input.mp4 -vcodec libvpx -pre 1080p ../output.mp4
ffmpeg version N-102649-g3ac7d99428 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10 (Ubuntu 10.2.0-13ubuntu1)
configuration: --disable-x86asm --enable-libvpx
libavutil 57. 0.100 / 57. 0.100
libavcodec 59. 1.100 / 59. 1.100
libavformat 59. 2.101 / 59. 2.101
libavdevice 59. 0.100 / 59. 0.100
libavfilter 8. 0.101 / 8. 0.101
libswscale 6. 0.100 / 6. 0.100
libswresample 4. 0.100 / 4. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../input.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41isomavc1
creation_time : 2015-08-07T09:13:36.000000Z
Duration: 00:00:30.53, start: 0.000000, bitrate: 4675 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 4486 kb/s, 30 fps, 30 tbr, 30 tbn (default)
Metadata:
creation_time : 2015-08-07T09:13:36.000000Z
handler_name : L-SMASH Video Handler
vendor_id : [0][0][0][0]
encoder : AVC Coding
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
Metadata:
creation_time : 2015-08-07T09:13:36.000000Z
handler_name : L-SMASH Audio Handler
vendor_id : [0][0][0][0]
Preset 1080p specified for stream 0:1, but could not be opened.
The -pre
option accepts stream specifiers and in the absence of any, will be applied to all streams. Since the default audio encoder for MP4 is aac
, ffmpeg will look for aac-1080p.avpreset
and then 1080p.avpreset
Since neither of those exist, ffmpeg errors out.
Change -pre
to either -vpre
or -pre:v
.