VP8
libvpx
is the VP8 video encoder for âWebM. FFmpeg and WebM Encoding Guide will walk you through webm specifics.
In this example, input.mov
is converted to output.webm
with a constant rate factor of 10
(lower is higher quality) at a bitrate of 1M
. Changing the bitrate to something lower (e.g. 700K
) will result in lower file sizes and lower quality. If your video does not have audio, you may leave off the -acodec libvorbis
part.
ffmpeg -i input.mov -vcodec libvpx -qmin 0 -qmax 50 -crf 10 -b:v 1M -acodec libvorbis output.webm
VP9
VP9 can encode videos at half the file size đđ You can check out Google’s VP9 encoding guide for their recommend settings or the FFmpeg VP9 guide.
Here’s an example from the FFmpeg guide:
ffmpeg -i input.mov -vcodec libvpx-vp9 -b:v 1M -acodec libvorbis output.webm
And here’s Google’s „Best Quality (Slowest) Recommended Settings“. You need to run the first line(s). It will create a log file (and warn you the out.webm is empty). On the second pass, the video will be output.
ffmpeg -i <source> -c:v libvpx-vp9 -pass 1 -b:v 1000K -threads 1 -speed 4 \ -tile-columns 0 -frame-parallel 0 -auto-alt-ref 1 -lag-in-frames 25 \ -g 9999 -aq-mode 0 -an -f webm /dev/null ffmpeg -i <source> -c:v libvpx-vp9 -pass 2 -b:v 1000K -threads 1 -speed 0 \ -tile-columns 0 -frame-parallel 0 -auto-alt-ref 1 -lag-in-frames 25 \ -g 9999 -aq-mode 0 -c:a libopus -b:a 64k -f webm out.webm
https://gist.github.com/Vestride/278e13915894821e1d6f
Maybe needed for iOS Safari?? -c:v libx265 -crf 28 -movflags faststart