I think the article you linked to is quite well written. You need a basic understanding of media encoding terminology to get started and not confuse codecs and containers as well as their properties.
Moreover, not every video is the same. Depending on the content and your presentation scenario you may want to change the encoding settings. Let's start with the profiles in h.264. From the article you posted:
Higher profiles use more optional features, offer better visual quality at smaller file sizes, take longer to encode, and require more CPU power to decode in real-time.
While mobile devices typically only support video encoded with the "baseline" profile, desktop applications can play "main" or "high" profile videos without issues. Here you need to make your first decision when encoding.
Then, think about quality and bit rate. Setting a quality factor for a certain video results in a certain average bit rate, and vice versa. There's no one command fits all here. In the following, you'll always have the choice between constraining a video to a certain bitrate or just setting a quality factor. The latter typically improves quality whereas the former gives you more control over a streaming scenario.
In general, the FFmpeg syntax for video bitrate is
-b:v <rate>, where
<rate> could be
1M, et cetera.
So I think you just need FFmpeg calls to create the following video files, based on the article about video on the web. Someone has already done this for Windows (although they seem outdated with regards to FFmpeg options). I tried to come up with my own commands.
Make one version that uses WebM (VP8 + Vorbis)
Let's start here. We specify the video and audio codecs with
We can use
qmin value for the encoder to choose when trying to reduce the file size. You should set the
b:v option to specify bitrate as well. Achieving good quality with libvpx is a little hard – see the VPX encoding guide for more info.
ffmpeg -i input.mp4 -c:v libvpx -qmax 42 -qmin 10 -b:v 1M -c:a libvorbis -q:a 4 -f webm out.webm
Play around with the audio options if you like. Vorbis defaults to 128 kBit/s but you can set
q:a between 0 and 10 (higher means better), with 4 being default.
Make another version that uses H.264 baseline video and AAC “low complexity” audio in an MP4 container.
That's pretty easy. Specify the codec and profile. Now you can choose a quality lefel (CRF, constant rate factor) for x264. Set it lower for higher quality and higher for worse quality (17-28 are sane values). You can also exchange the
crf option with
b:v for a certain bitrate.
ffmpeg -i input.mp4 -c:v libx264 -profile:v baseline -crf 23 -c:a libfaac out.mp4
The audio defaults to 128 kBit/s again, but you can set
q:a for variable bitrate, where values range from 0 to 500. 100 is default and higher means better. If
I don't know about the low complexity part here. If
libfaac does not work for you, use
-c:a aac -strict experimental instead, which doesn't deliver as good quality and doesn't do VBR, so you can only use
b:a. You can also use
libfdk_aac, which is the highest quality AAC encoder for FFmpeg. See the AAC encoding guide for more info.
Make another version that uses Theora video and Vorbis audio in an Ogg container.
Again, we'll specify the codec and re-use the audio options from above. You can set the quality through
q:a, where higher values mean higher quality. Values range from 0 to 10.
ffmpeg -i input.mp4 -c:v libtheora -q:v 4 -c:a libvorbis -q:a 4 out.ogg
Or just use a bitrate with
ffmpeg -i input.mp4 -c:v libtheora -b:v 1M -c:a libvorbis -q:a 4 out.ogg