[Theora] trying to encode from dvd using mplayer

Ivan Popov pin at medic.chalmers.se
Tue Dec 14 15:21:24 PST 2004

On Tue, Dec 14, 2004 at 10:21:48AM +0100, David Kuehling wrote:
> BTW encoding time can be shortened a lot by using the theora-mmx branch.
> Last time I tried it, it worked quite well and the resulting files could
> be played back flawlessly with the normal theora.
> Try:  (not sure about that)
>   svn co http://svn.xiph.org/trunk/theora-mmx   


as a reminder - as soon as one installs Coda file system
(a "easy install client" for Linux 2.6 and FreeBSD 5 is available)
one can run both recent theora tools and recent theora-aware mplayer,
directly, on those systems.

See http://www.konvalo.org/?pagename=Main.Software

I am using theora-encoder (which runs mmx-aware theoraenc with David's
keyframe distance and sharpness tweaks) and mplayer.
On hosts short of processor power "mplayer.theora-mmx" is more suitable,
it is linked to the decoder-specific-mmx-patched libtheora.

I encode like that:

theora-encoder -va -vf -va crop=704:424,scale=528:320,hqdn3d=4:3:6 \
               -s 64 -S 45 \
               -a 0 -v 5.4 -o 528-320-5.4-0-436.ogg \

(note that the original theora-encoder would not accept some arguments,
this is a slightly improved one)

That test transformed 122 minutes of DVD 1001x424 (really 720x424=>1024x424)
into 670 MB of 750x320 (really 528x320) which my 800 MHz Athlon can play
without frame drops.

I chose resolution and cropped a bit to get multiples of 16, to make encoder's
life more straightforward. Unsure if it influences the size or quality of
the resulting file.
I kept the pixel aspect ratio the same as in the original.

The result is not really "DVD quality" but it is pretty near.
The biggest problem is that it is impossible to know in advance
the size of the resulting file. Encoding with -V ("fixed" bitrate)
gives the desired size but yields worse quality on scenes with lot of motion.

In the test above there is some margin (more than 30 MB)
which can be used for subtitles and/or better audio.

Just for reference, to save subtitles you may use
  mencoder -oac copy -ovc copy -o /dev/null \
           -vobsubout swedish -slang sv \
resulting in swedish.sub and swedish.idx files to be used like
  mplayer my-theora-file.ogg -vobsub swedish -vobsubid 0

You can also save an audio track in a different language by
  mplayer -vc dummy -vo null \
          -ao pcm -aofile swedish.audio.wav -alang sv \
then (or on the fly using a fifo) compress it by
  oggenc [-q <0-10>] -o swedish.audio.ogg swedish.wav
and (theoretically) use with the movie as
  mplayer -audiofile swedish.audio.ogg my-theora-file.ogg
In practice, though, mplayer does _not_ synchronize the movie with an external
_ogg_vorbis_ audio file... too bad!
You still can use it by ogg123-ing to .wav and supplying the .wav file
as the argument to -audiofile, then it works. But alas you can't seek! :-(
Hope mplayer team will fix that deficiency soon.

(Anybody who knows how to use an external vorbis file with a theora movie
in some other player?)

My 2c

More information about the Theora mailing list