Encoding Videos

From Theora Playback Library
Revision as of 14:08, 27 November 2014 by Kspes (talk | contribs) (ffmpeg)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

There's not an abundance of tools to encode videos in the Theora format, so here you can read our recommended tools and techniques for encoding videos.

First of all, libtheoraplayer supports multiple codecs, not just Theora, depending on which plugins you use, read more here: Codecs.

ffmpeg2theora

ffmpeg2theora is a command line tool available for all the major OS's and is the recommended way to encode Theora videos. As the name suggests, it uses ffmpeg to read the source files which means it can pretty much read any format. Make sure you encode only from uncompressed sources as described on the Best Practices page. Uncompressed sources are either a series of images or an uncompressed video file (AVI, uncompresed MOV etc).

This tool supports a lot of fancy methods, be sure to read the documentation. The simplest way to encode a video with it is by this command:

ffmpeg2theora uncompressed_source.avi -v 8 -o output.ogv

  • -v 8 indicates the level of quality. values between 6 and 8 are usually the best compromise. For more control use the -V option to specify bitrate

if you have multiple images, use this:

Ffmpeg2theora.png

ffmpeg2theora image_%d.bmp -v 8 -o output.ogv

  • the source string is formatted similarly to the way C printf() function works.

Known bugs

If you're encoding a video from separate images, do not use png files! ffmpeg2theora reads them wrong, I don't know why. We recommend BMP files. If you use png's, you get something like this:

Ffmpeg2theora bug.jpg


Handbrake

Handbrake is a wonderful piece of open source software :) You can use it to encode h264 MP4 files that can be used on iOS and Mac as described on the Codecs page.

Handbrake.jpg


Known bugs

Sometimes, the video will be encoded in a way that the first frame is black... It's rare, don't know why it happens, don't know how to fix it using handbrake, if you encounter this, use ffmpeg in command line to encode the problematic video.


ffmpeg

And last but not least, you can always use the versatile ffmpeg command line tool to convert to either Theora or MP4.

Here is a good link with detailed intstructions.