#5140 closed defect (fixed)
libvpx-vp9 rejects cpu-used and speed values [-16, -9] and [9, 16]
Reported by: | Bouowmx | Owned by: | |
---|---|---|---|
Priority: | minor | Component: | avcodec |
Version: | git-master | Keywords: | libvpx |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
libvpx-vp9 rejects cpu-used values from -16 to -9 and 9 to 16 (inclusive), even though the included help claims it can accept it. However, libvpx (VP8 only) accepts the mentioned values. This means that VP9 encoding will only use half of the CPU, whereas VP8 encoding can use all of it.
The following is the help of libvpx-vp9:
ffmpeg -help encoder=libvpx-vp9 ffmpeg version N-77715-gfc703f5 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.2.0 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib libavutil 55. 12.100 / 55. 12.100 libavcodec 57. 21.100 / 57. 21.100 libavformat 57. 21.101 / 57. 21.101 libavdevice 57. 0.100 / 57. 0.100 libavfilter 6. 23.100 / 6. 23.100 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 Encoder libvpx-vp9 [libvpx VP9]: General capabilities: delay threads Threading capabilities: auto Supported pixel formats: yuv420p yuv422p yuv440p yuv444p libvpx-vp9 encoder AVOptions: -cpu-used <int> E..V.... Quality/Speed ratio modifier (from -16 to 16) (default 1) -auto-alt-ref <boolean> E..V.... Enable use of alternate reference frames (2-pass only) (default auto) -lag-in-frames <int> E..V.... Number of frames to look ahead for alternate reference frame selection (from -1 to INT_MAX) (default -1) -arnr-maxframes <int> E..V.... altref noise reduction max frame count (from -1 to INT_MAX) (default -1) -arnr-strength <int> E..V.... altref noise reduction filter strength (from -1 to INT_MAX) (default -1) -arnr-type <int> E..V.... altref noise reduction filter type (from -1 to INT_MAX) (default -1) backward E..V.... forward E..V.... centered E..V.... -deadline <int> E..V.... Time to spend encoding, in microseconds. (from INT_MIN to INT_MAX) (default good) best E..V.... good E..V.... realtime E..V.... -error-resilient <flags> E..V.... Error resilience configuration (default 0) default E..V.... Improve resiliency against losses of whole frames partitions E..V.... The frame partitions are independently decodable by the bool decoder, meaning that partitions can be decoded even though earlier partitions have been lost. Note that intra predicition is still done over the partition boundary. -max-intra-rate <int> E..V.... Maximum I-frame bitrate (pct) 0=unlimited (from -1 to INT_MAX) (default -1) -crf <int> E..V.... Select the quality for constant quality mode (from -1 to 63) (default -1) -static-thresh <int> E..V.... A change threshold on blocks below which they will be skipped by the encoder (from 0 to INT_MAX) (default 0) -undershoot-pct <int> E..V.... Datarate undershoot (min) target (%) (from -1 to 100) (default -1) -overshoot-pct <int> E..V.... Datarate overshoot (max) target (%) (from -1 to 1000) (default -1) -lossless <int> E..V.... Lossless mode (from -1 to 1) (default -1) -tile-columns <int> E..V.... Number of tile columns to use, log2 (from -1 to 6) (default -1) -tile-rows <int> E..V.... Number of tile rows to use, log2 (from -1 to 2) (default -1) -frame-parallel <boolean> E..V.... Enable frame parallel decodability features (default auto) -aq-mode <int> E..V.... adaptive quantization mode (from -1 to 3) (default -1) none E..V.... Aq not used variance E..V.... Variance based Aq complexity E..V.... Complexity based Aq cyclic E..V.... Cyclic Refresh Aq -speed <int> E..V.... (from -16 to 16) (default 1) -quality <int> E..V.... (from INT_MIN to INT_MAX) (default good) best E..V.... good E..V.... realtime E..V.... -vp8flags <flags> E..V.... (default 0) error_resilient E..V.... enable error resilience altref E..V.... enable use of alternate reference frames (VP8/2-pass only) -arnr_max_frames <int> E..V.... altref noise reduction max frame count (from 0 to 15) (default 0) -arnr_strength <int> E..V.... altref noise reduction filter strength (from 0 to 6) (default 3) -arnr_type <int> E..V.... altref noise reduction filter type (from 1 to 3) (default 3) -rc_lookahead <int> E..V.... Number of frames to look ahead for alternate reference frame selection (from 0 to 25) (default 25)
The following is the error I receive for using out-of-range cpu-used values:
ffmpeg -y -i "capture.mkv" -codec:v libvpx-vp9 -cpu-used 16 -f rawvideo NUL ffmpeg version N-77715-gfc703f5 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.2.0 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib libavutil 55. 12.100 / 55. 12.100 libavcodec 57. 21.100 / 57. 21.100 libavformat 57. 21.101 / 57. 21.101 libavdevice 57. 0.100 / 57. 0.100 libavfilter 6. 23.100 / 6. 23.100 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 Input #0, matroska,webm, from 'capture.mkv': Metadata: COMPATIBLE_BRANDS: isomiso2avc1mp41 MAJOR_BRAND : isom MINOR_VERSION : 512 ENCODER : Lavf57.21.100 Duration: 00:28:36.57, start: 0.000000, bitrate: 169973 kb/s Stream #0:0: Video: h264 (High 4:4:4 Predictive), yuv444p, 1280x960, SAR 1:1 DAR 4:3, 60 fps, 60 tbr, 1k tbn, 120 tbc (default) Metadata: HANDLER_NAME : VideoHandler ENCODER : Lavc57.21.100 libx264 DURATION : 00:28:36.567000000 Stream #0:1: Audio: flac, 44100 Hz, stereo, s16 Metadata: ENCODER : Lavc57.21.100 flac DURATION : 00:28:36.566000000 [libvpx-vp9 @ 000002cce2f20b00] v1.5.0 [libvpx-vp9 @ 000002cce2f20b00] Failed to set VP8E_SET_CPUUSED codec control: Invalid parameter [libvpx-vp9 @ 000002cce2f20b00] Additional information: cpu_used out of range [-8..8] Output #0, rawvideo, to 'NUL': Metadata: COMPATIBLE_BRANDS: isomiso2avc1mp41 MAJOR_BRAND : isom MINOR_VERSION : 512 encoder : Lavf57.21.101 Stream #0:0: Video: vp9 (libvpx-vp9), yuv444p, 1280x960 [SAR 1:1 DAR 4:3], q=-1--1, 200 kb/s, 60 fps, 60 tbn, 60 tbc (default) Metadata: HANDLER_NAME : VideoHandler DURATION : 00:28:36.567000000 encoder : Lavc57.21.100 libvpx-vp9 Side data: unknown side data type 10 (24 bytes) Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> vp9 (libvpx-vp9)) Press [q] to stop, [?] for help Received > 3 system signals, hard exiting time=00:00:00.33 bitrate= 544.2kbits/s speed=0.0765x
Note that the following command (VP8 encoding) will use all of the CPU:
ffmpeg -i "capture.mkv" -codec:v libvpx -cpu-used 16 -f rawvideo NUL
Whereas the maximum you can use for VP9 encoding is only 50%:
ffmpeg -i "capture.mkv" -codec:v libvpx-vp9 -cpu-used 8 -f rawvideo NUL
Change History (6)
comment:2 by , 9 years ago
Component: | undetermined → avcodec |
---|---|
Keywords: | libvpx added |
Priority: | normal → minor |
Reproduced by developer: | set |
Status: | new → open |
Patch sent.
comment:3 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | open → closed |
comment:4 by , 9 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Summary: | libvpx-vp9 rejects cpu-used values [-16, -9] and [9, 16] → libvpx-vp9 rejects cpu-used and speed values [-16, -9] and [9, 16] |
libvpx's "speed" parameter is an alias of "cpu-used" but the help concerning speed has not changed.
ffmpeg -h encoder=libvpx-vp9 ffmpeg version N-78843-g1c7e2cf Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.3.0 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib libavutil 55. 19.100 / 55. 19.100 libavcodec 57. 27.101 / 57. 27.101 libavformat 57. 27.100 / 57. 27.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 37.100 / 6. 37.100 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 Encoder libvpx-vp9 [libvpx VP9]: General capabilities: delay threads Threading capabilities: auto Supported pixel formats: yuv420p yuv422p yuv440p yuv444p gbrp libvpx-vp9 encoder AVOptions: -auto-alt-ref <boolean> E..V.... Enable use of alternate reference frames (2-pass only) (default auto) -lag-in-frames <int> E..V.... Number of frames to look ahead for alternate reference frame selection (from -1 to INT_MAX) (default -1) -arnr-maxframes <int> E..V.... altref noise reduction max frame count (from -1 to INT_MAX) (default -1) -arnr-strength <int> E..V.... altref noise reduction filter strength (from -1 to INT_MAX) (default -1) -arnr-type <int> E..V.... altref noise reduction filter type (from -1 to INT_MAX) (default -1) backward E..V.... forward E..V.... centered E..V.... -tune <int> E..V.... Tune the encoding to a specific scenario (from -1 to INT_MAX) (default -1) psnr E..V.... ssim E..V.... -deadline <int> E..V.... Time to spend encoding, in microseconds. (from INT_MIN to INT_MAX) (default good) best E..V.... good E..V.... realtime E..V.... -error-resilient <flags> E..V.... Error resilience configuration (default 0) default E..V.... Improve resiliency against losses of whole frames partitions E..V.... The frame partitions are independently decodable by the bool decoder, meaning that partitions can be decoded even though earlier partitions have been lost. Note that intra predicition is still done over the partition boundary. -max-intra-rate <int> E..V.... Maximum I-frame bitrate (pct) 0=unlimited (from -1 to INT_MAX) (default -1) -crf <int> E..V.... Select the quality for constant quality mode (from -1 to 63) (default -1) -static-thresh <int> E..V.... A change threshold on blocks below which they will be skipped by the encoder (from 0 to INT_MAX) (default 0) -drop-threshold <int> E..V.... Frame drop threshold (from INT_MIN to INT_MAX) (default 0) -noise-sensitivity <int> E..V.... Noise sensitivity (from 0 to 4) (default 0) -undershoot-pct <int> E..V.... Datarate undershoot (min) target (%) (from -1 to 100) (default -1) -overshoot-pct <int> E..V.... Datarate overshoot (max) target (%) (from -1 to 1000) (default -1) -cpu-used <int> E..V.... Quality/Speed ratio modifier (from -8 to 8) (default 1) -lossless <int> E..V.... Lossless mode (from -1 to 1) (default -1) -tile-columns <int> E..V.... Number of tile columns to use, log2 (from -1 to 6) (default -1) -tile-rows <int> E..V.... Number of tile rows to use, log2 (from -1 to 2) (default -1) -frame-parallel <boolean> E..V.... Enable frame parallel decodability features (default auto) -aq-mode <int> E..V.... adaptive quantization mode (from -1 to 3) (default -1) none E..V.... Aq not used variance E..V.... Variance based Aq complexity E..V.... Complexity based Aq cyclic E..V.... Cyclic Refresh Aq -speed <int> E..V.... (from -16 to 16) (default 1) -quality <int> E..V.... (from INT_MIN to INT_MAX) (default good) best E..V.... good E..V.... realtime E..V.... -vp8flags <flags> E..V.... (default 0) error_resilient E..V.... enable error resilience altref E..V.... enable use of alternate reference frames (VP8/2-pass only) -arnr_max_frames <int> E..V.... altref noise reduction max frame count (from 0 to 15) (default 0) -arnr_strength <int> E..V.... altref noise reduction filter strength (from 0 to 6) (default 3) -arnr_type <int> E..V.... altref noise reduction filter type (from 1 to 3) (default 3) -rc_lookahead <int> E..V.... Number of frames to look ahead for alternate reference frame selection (from 0 to 25) (default 25)
FFmpeg gives the same error as in the original ticket:
ffmpeg -i "capture libvpx-vp9 lossless quality=good speed=0 threads=2 an.mkv" -codec:v libvpx-vp9 -lossless 1 -speed 16 -threads 10 -f null - ffmpeg version N-78843-g1c7e2cf Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.3.0 (GCC) configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib libavutil 55. 19.100 / 55. 19.100 libavcodec 57. 27.101 / 57. 27.101 libavformat 57. 27.100 / 57. 27.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 37.100 / 6. 37.100 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 Input #0, matroska,webm, from 'capture libvpx-vp9 lossless quality=good speed=0 threads=2 an.mkv': Metadata: ENCODER : Lavf57.27.100 Duration: 00:09:13.44, start: 0.000000, bitrate: 11940 kb/s Stream #0:0: Video: vp9 (Profile 1), yuv444p(tv), 480x640, lossless, SAR 1:1 DAR 3:4, 50 fps, 50 tbr, 1k tbn, 1k tbc (default) Metadata: ENCODER : Lavc57.27.101 libvpx-vp9 DURATION : 00:09:13.440000000 [libvpx-vp9 @ 0000018bfa097160] v1.5.0 [libvpx-vp9 @ 0000018bfa097160] Failed to set VP8E_SET_CPUUSED codec control: Invalid parameter [libvpx-vp9 @ 0000018bfa097160] Additional information: cpu_used out of range [-8..8] Output #0, null, to 'pipe:': Metadata: encoder : Lavf57.27.100 Stream #0:0: Video: vp9 (libvpx-vp9), yuv444p, 480x640 [SAR 1:1 DAR 3:4], q=-1--1, 200 kb/s, 50 fps, 50 tbn, 50 tbc (default) Metadata: DURATION : 00:09:13.440000000 encoder : Lavc57.27.101 libvpx-vp9 Side data: cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1 Stream mapping: Stream #0:0 -> #0:0 (vp9 (native) -> vp9 (libvpx-vp9)) Press [q] to stop, [?] for help
comment:5 by , 9 years ago
The error you are seeing comes directly from libvpx, so clearly cpu used outside of -8..8 is not valid for whichever libvpx version you are using.
Checking the documentation a bit more thorough, -8..8 is the appropriate range for vp9, only vp8 supports -16..16
comment:6 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Note that "speed" is only provided as a legacy parameter, it should not be used anymore. cpu-used is the official parameter.
Contrary to its name, cpu-used doesn't actually control how much overall CPU is being used, it controls the quality of the encode (ie. how much cpu is used for each frame in total), and both vp8 and vp9 could have different limits. The vp9 encoder doesn't scale well with high cpu core counts, so 50% already seems pretty good.