How to convert videos to WebM (VP9) format with FFmpeg
Convert your videos to WebM (VP9) format with FFmpeg while maintaining their quality.
The two pass constant quality mode
$ ffmpeg -i input.mpg -b:v 0 -crf 30 -pass 1 -an -f webm -y /dev/null
$ ffmpeg -i input.mpg -b:v 0 -crf 30 -pass 2 output.webm
By setting the video bitrate to zero while specifying 30 as the CRF (constant rate factor) we enable constant quality mode which provides a certain level of quality. For VP9, the CRF can range from 0 (best quality) to 63 (smallest file size).
With WebM (VP9) it is preferable to encode in two passes for best results. The first pass collects statistics about the video which are then used in the second pass to make a smaller, higher quality video.
Source: FFmpeg and VP9 Encoding Guide . Header image from the WebM Project .