webm
& ffmpeg
webm
from the web, Screencasts and elsewherehttps://smcnally.github.io/kb/webm-ffmpeg-Screencasts
webm
is a default animation and video format on multiple sites. Ubuntu 22.04
’s default screencast utility creates compact webm
files in ~/Videos/Screencasts
by default.
ffmpeg
handles webm
and can convert it to other formats like .gif
, .mp4
, and .mkv
for working in tools with little or no webm
capabilities.
This works to output webm
to mp4
that plays as expected in VLC and other players and editors:
ffmpeg -i screencast.webm -filter:v "fps=30" screencast.mp4
This works in more cases and avoids ffmpeg
throwing ‘not divisible by 2’ errors:
ffmpeg -i screencast.webm -filter:v "scale=trunc(iw/2)*2:trunc(ih/2)*2,fps=30" screencast.mp4
The above sets a constant frame rate of 30 frames per second (fps
). It resizes source video by one pixel @ most and makes sure your input width and height (iw
and ih
) are even numbers.
ffmpeg
’s Video Options are plentiful, powerful, and best approached by particulars.
Deeper dives into other ffmpeg recipes
Related Q&A helpful during this research include: