Convert video from .mp4 to .ogg

I am using ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers . I need to convert a file .mp4, to .ogg format. I am on Mac OS X, and I have tried this so far:

ffmpeg -i sample_mpeg4.mp4 -acodec vorbis -vcodec libtheora -f ogg output.ogv

I am getting: Unknown encoder 'libtheora'

ffmpeg -i sample_mpeg4.mp4 -acodec libvorbis -vcodec --enable-libtheora output.ogv

I am getting: Unknown encoder '--enable-libtheora'

ffmpeg -i sample_mpeg4.mp4 -acodec libvorbis -vcodec libtheora -f ogv output.ogv

I am getting:

[NULL @ 0x7f81bb00f800] Requested output format 'ogv' is not a suitable output format
output.ogv: Invalid argument

ffmpegtheora is not an option as it can not be install on the server.


Solution 1:

Your FFmpeg version is missing the required encoders, libtheora for Theora video and libvorbis for Vorbis audio.

You can only add these encoders by either

  • compiling them with FFmpeg, or
  • installing an executable that bundles them already.

For you the easiest choice would be to download a static version from the FFmpeg download page. They all come with libtheora and libvorbis, regardless of the operating system they were built for.

What you then need to do is extract the download archive and simply run the ffmpeg binary that was included. The correct syntax would be:

ffmpeg -i in.mp4 -c:v libtheora -c:a libvorbis out.ogv

If you want to change the quality for either audio or video, you can change the bit rate, e.g. with -b:v 1M or -b:a 192k. Play with those values and use a higher or lower bitrate depending on the quality or file size constraints you have.

You can also use VBR (constant quality) with -q:v, where values range from 0 to 10 (higher is better), with 7 being recommended. The audio quality can be set with -q:a, again with values from 0 to 10, where 4 is recommended and corresponds to roughly 128 kBit/s.

Note that --enable-libtheora is a configuration option and doesn't work when calling ffmpeg.

Solution 2:

Use Homebrew package manager

Install Homebrew in command line

$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

Install ffmpeg with libtheora support

$ brew install ffmpeg --with-theora --with-libvorbis

Other options are listed here

$ brew options ffmpeg

Hope it helps others or future me ;)