Posted: . At: 9:39 AM. This was 9 months ago. Post ID: 18271
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


How to encode a nice long Webm with sound easily.


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.

webm.sh
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.

A screenshot from a high-quality webm file.

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.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.