[Theora] Playback too slow?!
pin at medic.chalmers.se
Wed Mar 30 00:46:04 PST 2005
On Wed, Mar 30, 2005 at 12:46:59AM +0200, Ole Tange wrote:
> > 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 \
> > dvd://1
> How do you detect these values?
> I guess 704:424 is from 'mplayer -vf cropdetect'. 528:320 and 4:3:6 is
> probably your own idea though it is not clear to me why you chose
> precisely these values. But where do -s 64 -S 45 come from? What I am
well, it is not exactly easy...
64/45 came from the dvd movie itself - that is the aspect ratio of the pixels.
Looking at mplayer output while playing the movie you see what is
"pixels x pixels" size and what is the right picture aspect, then you want to
recalculate that to "pixel aspect" which theora uses.
Those numbers (sadly) vary from movie to movie, according to the choice
of the manufacturer. You can have all from square pixels to very wide
>>That test transformed 122 minutes of DVD 1001x424 (really 720x424=>1024x424)
That particular movie (excluding the extra black areas) has the aspect ratio
about 2.4, while it is coded as 720x424 pixels, so each pixel represents
a non-quare rectangular.
I deliberately crop it to the more standard 2.35 aspect ratio,
keeping the pixel aspect intact. So crop visible 1024->1001 means
crop internal 720->704.
>>into 670 MB of 750x320 (really 528x320) which my 800 MHz Athlon can play
>>without frame drops.
I chose to keep the pixel aspect ratio intact, to avoid extra interpolation.
Then I scale down the resolution to both reduce the resulting file size
and ensure that my hardware can cope with it in real time.
So, 704x424 representing about 1001x424 on the screen became
528x320 representing about 750x320.
In contrast, ffmpeg2theora converts the image to square pixels before
encoding to theora. That is a more straightforward approach,
though it introduces some minor loss in quality and also is slightly less
efficient at encoding.
Anyway, for both approaches you (or the program) have to know
the "right" aspect ratio, which is not always correctly present in the
original file (surprise :)
> after is: Could these be autodetected so the normal user will not need to
> figure these out?
Normally a program (in our case mplayer) can figure it out.
Unfortunately mplayer uses the aspect ratio at the display level,
not at the decoding level, so that theoraenc does not get the information
in the yuv4mpeg stream.
About the hqdn3d parameters, they should be tuned for the particular file.
They are definitely different when I encode tv shows taken by the same receiver
card on different channels - as the noise level is different.
The numbers above improve compression while do not remarkably influence
the quality of a dvd source. They come from mplayer manual, I think.
On some movies you want also a deinterlacing and/or
reverse telecine filter (see man mplayer).
> I am all for configurability. But if we have good defaults that give
> excellent results in most cases then it will be easier for non-geeks to
Alas, I am not aware of such defaults :) All cases are indeed very different.
One dvd movie I trancoded became 3 CDs, the first one containing exactly
a half of the movie, and two others - one quarter each. The reason was
that the second part of the movie contained a lot of motion and I could
not use the same quality setting and get the same compressed size.
> use theora without tweaking.
Some day when the "fixed bitrate" mode will be improved, may be.
It depends also on your preferences.
> I am quite impressed with the speedup your suggestions made. From 90% CPU
> usage I am now around 40% - i.e no framedropping and quite usable. Thank
Thanks. You are welcome.
May be I should put ffmpeg2theora on konvalo.org as well.
It does not exactly suit my purposes, but possibly will be of use for others.
More information about the Theora