All posts
Video to WebM via CLI
Re-encode any video to VP9 + Opus with ffmpeg.
Open online converterPackages to install
Install ffmpeg built with libvpx-vp9 and libopus — Ubuntu’s package includes both.
ffmpeg
sudo apt-get update
sudo apt-get install -y ffmpegHow to run the command
ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 32 -b:v 0 -deadline good -cpu-used 4 -c:a libopus -b:a 96k output.webm. The same profile works for MOV, MKV, and AVI.
ffmpeg -y -i input.mp4 -c:v libvpx-vp9 -crf 32 -b:v 0 -deadline good -cpu-used 4 -c:a libopus -b:a 96k output.webmDockerfile example
Build a minimal Ubuntu image with the required packages and run the conversion inside the container.
FROM ubuntu:24.04
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ffmpeg && \
rm -rf /var/lib/apt/lists/*
WORKDIR /work
docker build -t video-to-webm .
docker run --rm -v "$PWD:/work" -w /work video-to-webm \
ffmpeg -y -i input.mp4 -c:v libvpx-vp9 -crf 32 -b:v 0 -deadline good -cpu-used 4 -c:a libopus -b:a 96k output.webmExample commands
Run these locally after installing the packages, or inside the container from the Dockerfile.
ffmpeg -y -i input.mp4 -c:v libvpx-vp9 -crf 32 -b:v 0 -deadline good -cpu-used 4 -c:a libopus -b:a 96k output.webmffmpeg -y -i input.mov -c:v libvpx-vp9 -crf 32 -b:v 0 -deadline good -cpu-used 4 -c:a libopus -b:a 96k output.webm