VP9

From LinuxReviews
Jump to navigationJump to search
VP9
Filename extension
webm, mkv
Developed byGoogle
Initial releaseJune 17, 2013
Type of formatCompressed video
Contained by
  • Matroska
  • WebM
  • IVF
Extended fromVP8
Extended toAV1
Standard(Bitstream Specification)
Open format?Yes
Websitewebmproject.org/vp9

VP9 is a advanced free video coding format developed mainly by Google. The format is well supported on Linux and most other operating systems and devices. All the major web browsers except those made by Apple support VP9 playback.

Newer Intel iGPUs support hardware encoding and decoding on Linux using VAAPI. The latest AMD graphics cards can do hardware decoding but they can not do hardware encoding.

Patents

VP9 is royalty-free but it not patent-free. Google holds several patents on aspects of the format. Google has guaranteed that it will not take action against anyone using the VP9-related patents it holds.

Web Browser Support

VP9 is supported by all the major web browsers except those made by American computer giant Apple.

Video formats supported by web browsers
Browser H.264/MPEG-4 AVC (MP4) HEVC (MP4) VP8 (WebM) VP9 (WebM) AV1 (WebM)
Android browsers Dialog-ok.svg Dialog-ok.svg Dialog-ok.svg Dialog-ok.svg Dialog-ok.svg
Chromium Blond-anime-girl-with-red-questionmark.png Depends on the build Dialog-cancel.svg Dialog-ok.svg Dialog-ok.svg Dialog-ok.svg
Google Chrome Dialog-ok.svg Dialog-cancel.svg Dialog-ok.svg Dialog-ok.svg Dialog-ok.svg
Microsoft Edge
(Modern Chromium based versions)
Dialog-ok.svg Blond-anime-girl-with-red-questionmark.png Only if hardware decoding is available Dialog-ok.svg Dialog-ok.svg Dialog-ok.svg
Falkon Dialog-cancel.svg Dialog-cancel.svg Dialog-ok.svg Dialog-ok.svg Dialog-ok.svg
Mozilla Firefox Dialog-ok.svg Blond-anime-girl-with-red-questionmark.png if ffmpeg supports it Dialog-cancel.svg Dialog-ok.svg Dialog-ok.svg
Safari (macOS/iOS) Dialog-ok.svg Dialog-ok.svg Construction.png only for WebRTC Dialog-cancel.svg Dialog-cancel.svg
GNOME Web Dialog-ok.svg Blond-anime-girl-with-red-questionmark.png if gstreamer codecs are present Blond-anime-girl-with-red-questionmark.png if gstreamer codecs are present Dialog-ok.svg Dialog-ok.svg

Hardware Encoding / Decoding

Intel graphics chips have had support for basic VP9 hardware decoding since Apollo Lake. Kaby Lake and newer are capable of basic hardware encoding. Intel chips did not get support for hardware encoding 10-bit video until Ice Lake. Neither Ice Lake, Tiger Lake or any other Intel chips is capable of 12-bit VP9 hardware encoding.

AMD APUs and graphics cards did not get any VP hardware decoding capabilities until "Video Core Next" was introduced with Navi, Raven and Renoir chips. No existing AMD graphics hardware is capable of VP9 hardware encoding and the upcoming AMD "Sienna Cichlid" and "Navy Flounder" graphics chips will not change that. AMD simply isn't there when it comes to VP9 hardware encoding.

VP9 Video Encoding Using ffmpeg

ffmpeg is the best tool for encoding/transcoding video to VP9. The amount of options you need to software encode VP9 efficiently on a modern CPU is, sadly, staggering. Creating a simple script with all the options required and/or desired is therefore likely preferable to remembering all of them.

File: ffmpeg-encode-VP9.sh
#!/bin/bash
inputf="$*"
inputnoext="${inputf%.*}"
outputf="${inputnoext}.webm"

nice -n 19 ffmpeg -i "$*" \
   -c:v libvpx-vp9 -crf 30 \
   -b:v 9000k \
   -c:s webvtt \
   -metadata major_brand="" \
   -metadata minor_version="" \
   -metadata compatible_brands="" \
   -metadata:s:a handler_name="ISO media created using ffmpeg" \
   -metadata:s:v handler_name="ISO media created using ffmpeg" \
   -threads 4 -row-mt 1 \
   -tile-columns 6 -frame-parallel 1 \
   -auto-alt-ref 1 -lag-in-frames 25 \
   -ac 2 -c:a libopus -b:a 192k \
   -strict experimental  \
   -f webm "${outputf}"

The more important options you likely want to keep in the above example are:

Option What Why
-c:v libvpx-vp9 Selects VP9 codec
-crf 30 Sets the quality Lower number results in better quality, higher number results in worse
-b:v 9000k Constrains bitrate to below 9000k A bitrate constraint can be combined with -crf to ensure that the video bitrate never goes above this threshold.
-threads 4 Number of theads You may want to increase it to 8 or 12 if you have more cores. This option is useless without other options, see below.
-row-mt 1 Required for multiple threads You want it
-frame-parallel 1 Encode frames in parallel Utilizes more threads
-tile-columns 6 Encode 6 columns in parallel Utilizes more threads
-c:a libopus You want to pair VP9 with Opus audio Specially true if you want to make a .webm for the web
-ac 2 Limit audio to two channels This is a requirement if you use a WebM container. It is not if you use a MKV container.
-b:a 192k Audio bitrate 192k is actually quite high for Opus audio. You could lower it but 192k is not much compared to the video so there is little reason to potentially hamper audio quality.

Web Content Management Software

VP9 is supported by all web browsers except those made by some American fruit company who sells small square grossly overpriced locked-down computing devices. It is therefore safe to use only VP9 for all video purposes on the Internet (even if the free software foundation disagrees).

Many content management systems support VP9 but some do not unless you install extensions. MediaWiki supports transcoding video files uploaded by users to VP9 video files in different configured resolutions if you install the TimedMediaHandler extension.

Add your comment
LinuxReviews welcomes all comments. If you do not want to be anonymous, register or log in. It is free.