Convert Video to Ogg Theora with FFmpeg
This guide provides a straightforward tutorial on how to convert video files to the Ogg Theora format using the powerful command-line tool FFmpeg. You will learn the basic conversion commands, how to adjust video and audio quality, and how to customize settings to ensure compatible, high-quality open-source video playback.
Basic Conversion Command
To convert any input video (such as MP4, MKV, or AVI) to an Ogg
Theora video file, you need to specify the Theora video encoder
(libtheora) and the Vorbis audio encoder
(libvorbis).
Run the following command in your terminal:
ffmpeg -i input.mp4 -c:v libtheora -c:a libvorbis output.ogv-i input.mp4: Specifies the input video file.-c:v libtheora: Sets the video codec to Theora.-c:a libvorbis: Sets the audio codec to Vorbis (the standard audio companion for Ogg files).output.ogv: The name of the resulting output file (using the.ogvextension for Ogg Video).
Controlling Video and Audio Quality
By default, FFmpeg will use auto-selected bitrates, which might not
yield the desired quality or file size. You can control the output
quality using quality scale flags (-q:v for video and
-q:a for audio).
Adjusting Video Quality
The -q:v option uses a scale from 0 to 10, where 10 is
the highest quality (and largest file size) and 0 is the lowest. A value
of 6 or 7 is generally recommended for a good balance.
ffmpeg -i input.mp4 -c:v libtheora -q:v 7 -c:a libvorbis -q:a 5 output.ogvAdjusting Audio Quality
Similarly, the -q:a option controls the Vorbis audio
quality on a scale of -1 to 10. A setting of 3 to 5 is ideal for
standard stereo audio.
Advanced Configurations
Changing Video Resolution
If you want to resize the video during the conversion process, use
the scale filter (-vf scale):
ffmpeg -i input.mp4 -c:v libtheora -q:v 6 -vf scale=1280:720 -c:a libvorbis -q:a 4 output.ogvStripping Audio
If you want to convert a video to Ogg Theora without any audio track,
use the -an flag:
ffmpeg -i input.mp4 -c:v libtheora -q:v 6 -an output.ogv