| layout | default |
|---|---|
| nav_order | 4.95 |
| title | VP8 Encoding |
| parent | Codec Comparisons |
Table of contents
{: .text-delta } 1. TOC {:toc}VP8 is an open-source and royalty free codec developed by On2 Technologies (later bought by Google) and now maintained as part of the WebM Project. It will only encode to 8-bit 4:2:0 using the webm container. It is possible to get a similar quality to H.264, but not typically at the same compression ratio. It is recommended that you consider VP9 which is a considerably better codec. VP8 does support an alpha channel (via the yuva420p pixfmt).
General FFmpeg info on VP8 is here, and on the encoder in general https://www.webmproject.org/docs/encoder-parameters/.
VP8 has browser support in:
- Chrome.
- Edge
- Firefox
- Opera
VP8 is supported by mkv and webm containers, no support exists for mov or mp4.
libvpx has a limited range of pixel formats: yuv420p yuva420p
Example encoding:
ffmpeg -r 24 -start_number 1 -i inputfile.%04d.png -frames:v 200 \
-c:v libvpx -crf 20 -b:v 200M -pix_fmt yuv420p \
-qmin 0 -qmax 50 -quality good -speed 4 \
-vf "zscale=matrix=709:range=limited:filter=lanczos,setparams=color_primaries=bt709:color_trc=iec61966-2-1" \
-color_range tv -colorspace bt709 -color_primaries bt709 -color_trc iec61966-2-1 \
-y outputfile.webm-crf 20 -quality good -b:v 200M -speed 4 | Flag | Description |
|---|---|
| -crf 20 | This is the constant quality rate factor, controlling the default quality, similar to H.264. The range is a little different to H.264, so you may need to test. |
| -quality good | May require additional testing, but so far switching to -quality best increased the duration, but didn't increase the VMAF score (which is already pretty high with these values of crf). |
| -b:v 200M | Unlike with H.264, and VP9 you need to set the bit rate, but you can set it to a high number, and this is the max it would be. |
| -speed 4 | It sets how efficient the compression will be. Unless you are using -quality best. |
It's possible you might want to change the GOP values (changed with the -g flag): by default libvpx puts a keyframe every 128 frames (FFmpeg 6.1.6 and 9.0.2).
Below is a comparison of different CRF rates, with -b:v 200M and -quality good
|
This is showing CRF values against encoding time. |
|
This is showing CRF values against file size. |
|
This is showing CRF values against VMAF harmonic mean |
|
This is showing CRF values against psnr y harmonic mean |
Below is a comparison of different speed rates, -quality good vs. -quality best and with -crf 22, -b:v 200M.
This shows that with -quality good the filesize doesn't vary, but with increasing speed settings the encoding time goes down.
|
This is showing speed against encoding time. |
|
This is showing speed values against file size. |
|
This is showing speed values against VMAF harmonic mean |
|
This is showing speed values against psnr y harmonic mean |