Encoding a long webm with good quality is challenging, but it can be done. The example below uses only one pass and is easily able to encode a nice long webm file that is nearly 2 minutes long and is still only 6.1 megabytes.
│[jcartwright@localhost:0 ~]$ ffmpeg -ss 01:24:43 -t 72 -i video.mkv -threads 0 -vf scale=720:576 -g 999 -c:v libvpx-vp9 -c:a libvorbis -b:v 4M -crf 45 -qmin 35 -qmax 63 -y -sn fist.webm |
This is a very easy way to encode with very good quality. Below is an example with sound.
Another way to get the best quality is with 2-pass encoding. This can maximize the quality you can get out of your webm files.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/bin/bash # Input video file input_file="flash.mkv" # Output video file output_file="flash.webm" time_stamp="01:01:01" ffmpeg -ss $time_stamp -t 72 -i $input_file -threads 0 -vf scale=720:576 -g 999\ -c:v libvpx-vp9 -c:a libvorbis -b:v 4M -crf 45 -qmin 35 -qmax 63 -y -sn -pass 1 -f webm /dev/null ffmpeg -ss $time_stamp -t 72 -i $input_file -threads 0 -vf scale=720:576 -g 999\ -c:v libvpx-vp9 -c:a libvorbis -b:v 4M -crf 45 -qmin 35 -qmax 63 -y -sn -pass 2 $output_file |
This provides the maximum possible quality in a compact webm file.
Here is a screenshot.
So, this is a very good solution for high-quality webm encoding from a good-quality source. Posting webm files on the 4chan /wsg/ board can be fun, this script will be very helpful.