Let's just say i was trying to learn how to better use ffmpeg,
and started asking myself "What are the things i needed when working with video content?".
And this is one of the things that came to mind.
I had a bunch of videos, that used the H.264 format, taking alot of disk space.
Was looking around for alternative formats, to save space. The best options at that time were VP9 and AV1.
Both compress really well, but AV1 is more aggressive in compressing the video stream, and combined with OPUS audio,
this resulted in better file size reductions while ensuring minimal quality loss.
Now, regarding container formats to use, i have found so far two options.
And these are WebM and MKV.
Choose MKV due to it being one of the best multimedia container formats out there, but any of these two should work fine.
Using ffmpeg
The most used option to encode a video AFAIK.
Here is a simple Linux script i made (using the installed ffmpeg package on Linux Mint) that
converts whatever video file into a separate .mkv AV1 encoded video file,
that is rescaled to 720p with solid quality parameters.
#!/usr/bin/env bash
#################################################
# Encode a video file into the AV1 video format #
# using OPUS audio within a .webm container. #
#################################################
ffmpeg \
-i "${1}" \
-codec:v libsvtav1 -vf scale=-1:720 -crf 35 -preset 6 \
-codec:a libopus -b:a 192k \
"${1//.*/.mkv}"
- The 1. argument is the input filepath.
The output filepath is the input one, with the suffix changed to .mkv .