Changes between Version 4 and Version 5 of Encode/VP9
- Timestamp:
- Jun 21, 2017, 1:04:19 PM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Encode/VP9
v4 v5 1 1 libvpx-vp9 is the VP9 video encoder for [http://www.webmproject.org/about/ WebM], an open, royalty-free media file format. This guide is an attempt to summarize the most important options for creating video with libvpx-vp9. 2 2 3 To install FFmpeg with support for libvpx-vp9, look at the [https://ffmpeg.org/trac/ffmpeg/wiki/CompilationGuide Compilation Guides] and compile FFmpeg with the {{{--enable-libvpx}}} option. 3 To install FFmpeg with support for libvpx-vp9, look at the [https://ffmpeg.org/trac/ffmpeg/wiki/CompilationGuide Compilation Guides] and compile FFmpeg with the {{{--enable-libvpx}}} option. Note that for 10-bit encoding, you need to set the `--enable-vp9-highbitdepth` configuration option. 4 4 5 5 Note that in the below examples, the libvorbis audio encoder is used. Make sure your FFmpeg version also includes libvorbis (check with {{{ffmpeg -codecs}}}), as the native Vorbis encoder from FFmpeg does not provide comparable quality. … … 7 7 == Variable Bitrate ==#variableb 8 8 9 libvpx-vp9 offers a variable bitrate mode by default. In this mode, it will simply try to reach the specified bit rate on average, e.g. 1MBit/s. This is the "target bitrate".9 libvpx-vp9 offers a variable bitrate (VBR) mode by default. In this mode, it will simply try to reach the specified bit rate on average, e.g. 2 MBit/s. This is the "target bitrate". 10 10 11 11 {{{ 12 ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 1M -c:a libvorbis output.webm12 ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 2M -c:a libvorbis output.webm 13 13 }}} 14 14 … … 17 17 === Constant Quality ===#constantq 18 18 19 In addition to the "default" VBR mode, there's a constant quality mode (like in the x264 encoder) that will ensure that every frame gets the number of bits it deserves to achieve a certain (perceptual) quality level, rather than forcing the stream to have an average bit rate. This results in better overall quality and should be your method of choice when you encode video with libvpx-vp9. 19 In addition to the "default" VBR mode, there's a constant quality (CQ) mode (like in the x264 encoder) that will ensure that every frame gets the number of bits it deserves to achieve a certain (perceptual) quality level, rather than forcing the stream to have an average bit rate. This results in better overall quality and should be your method of choice when you encode video with libvpx-vp9. 20 20 21 To trigger this mode, you must use a combination of `-crf` and `-b:v` 0. `-b:v` '''MUST''' be 0. 21 22 22 23 {{{ 23 ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 10 -b:v 0 -c:a libvorbis output.webm24 ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 30 -b:v 0 -c:a libvorbis output.webm 24 25 }}} 25 26 26 The CRF value can be from 0–63. Lower values mean better quality. 27 The CRF value can be from 0–63. Lower values mean better quality. Recommended values range from 15–35, with 31 being recommended for 1080p HD video. See [https://developers.google.com/media/vp9/settings/vod/ this guide] for more info. 27 28 28 29 === Constrained Quality ===#constrainedq 29 30 30 libvpx-vp9 also has a constrained quality mode that will ensure that a constant (perceptual) quality is reached while keeping the bitrate below a specified upper bound. Useful for bulk encoding videos in a generally consistent fashion.31 libvpx-vp9 also has a constrained quality (CQ) mode that will ensure that a constant (perceptual) quality is reached while keeping the bitrate below a specified upper bound or within a certain bound. This method is useful for bulk encoding videos in a generally consistent fashion. 31 32 32 33 {{{ 33 ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 10 -b:v 1000k -c:a libvorbis output.webm34 ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 30 -b:v 2000k -c:a libvorbis output.webm 34 35 }}} 35 36 36 37 The quality is determined by the `-crf`, and the bitrate limit by the `-b:v` where the bitrate '''MUST''' be non-zero. Note: for videos that are "easy" to encode this mode behaves exactly like the [#constantq Constant Quality] mode and actual bitrate may be lower than specified bitrate while for videos that are "hard" to encode the quality will be bounded by the maximum bitrate and will behave like the [#variableb Variable Bitrate] mode. 37 38 39 You can also specify a minimum and maximum bitrate instead of a quality target: 40 41 {{{ 42 ffmpeg -i input.mp4 -c:v libvpx-vp9 -minrate 500k -b:v 2000k -maxrate 2500k -c:a libvorbis output.webm 43 }}} 44 38 45 == Constant Bitrate == 39 46 40 Like most other encoders, libvpx offers a constant bitrate encoding mode as well, which tries to encode the video in such a way that an average bitrate is reached. This doesn't mean that every frame is encoded with the same amount of bits (since it would harm quality), but the bitrate will be very constrained. You should use constant bitrate encoding if you need your video files to have a certain size, or if you're streaming the videos over a channel that only allows a certain bit rate.47 Like most other encoders, libvpx offers a constant bitrate (CBR) encoding mode as well, which tries to encode the video in such a way that an average bitrate is reached. This doesn't mean that every frame is encoded with the same amount of bits (since it would harm quality), but the bitrate will be very constrained. You should use constant bitrate encoding if you need your video files to have a certain size, or if you're streaming the videos over a channel that only allows a certain bit rate. 41 48 42 49 The syntax for setting a constant bit rate is:
