[theora] Poor encoding quality with etheora and aspect ratio problem

Manuel Dahmen manuel.dahmen at gmail.com
Sun Mar 9 06:04:49 PDT 2008


On Sun, 9 Mar 2008 04:00:14 -0300
"Ribamar Santarosa de Sousa" <ribamar.santarosa at gmail.com> wrote:

> Manuel,
> 
> can you test the version in
> http://svn.xiph.org/experimental/ribamar/etheora/ ?
> 
> The final resolution (Fr) shown by  the mplayer output is the video
> frame resolution (fr) multiplied by the Aspect ratio (Ar):
> 
> Fr = fr * Ar. This should be the 16:9 or 4:3 final visual you probably
> expected to see shown by  the mplayer output. Etheora was doing:
> 
> Ar = fr, what led to problems. Now etheora does:
> 
> Ar = Fr / fr,  which I expect to led to the correct values, but I may
> have missed any test. Can you see (and report) if now it's working?


I ran some tests this morning with the new version.

What I was doing  before in my source code is adding this code between
enc_setup and enc_start:
	ec->ti.width=width;
	ec->ti.height=height;
	ec->ti.frame_width=width;
	ec->ti.frame_height=height;
	ec->ti.aspect_numerator=1;
	ec->ti.aspect_denominator=1;
	// So I keep the original resolution when playing, with square
	//pixel ratio (for drawing shapes in processing.org).

Here is mplayer output (file are named
"movie-{ASPECT_CONSTANT}-WIDTHxHEIGHT" where width and height are the
values passed in etheora_enc_setup. I commented these lines for the
tests below. I put the resulting videos here :
http://poux.be/tmp/video__test21/


ETHEORA_ASPECT_NORMAL
---------------------

mplayer movienew-normal640x480.ogg 
Opening video decoder: [theora] Theora/VP3
VDec: vo config request - 640 x 480 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [xv] 640x480 => 854x480 Planar YV12 

Playing movienew-normal400x400.ogg.
[Ogg] stream 0: video (Theora v3.2.1), -vid 0
Ogg file format detected.
VIDEO:  [theo]  400x400  24bpp  15.000 fps    0.0 kbps ( 0.0 kbyte/s)
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
[theora @ 0x892a230]Missing extradata!
Could not open codec.
VDecoder init failed :(
Opening video decoder: [theora] Theora/VP3
VDec: vo config request - 400 x 400 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
VO: [xv] 400x400 => 534x400 Planar YV12 
Selected video codec: [theora] vfm: theora (Theora (free, reworked VP3))

ETHEORA_ASPECT_WIDE_SCREEN
--------------------------

Playing movienew-wide400x400.ogg.
[Ogg] stream 0: video (Theora v3.2.1), -vid 0
Ogg file format detected.
VIDEO:  [theo]  400x400  24bpp  15.000 fps    0.0 kbps ( 0.0 kbyte/s)
xscreensaver_disable: Could not find XScreenSaver window.
GNOME screensaver disabled
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
[theora @ 0x892a230]Missing extradata!
Could not open codec.
VDecoder init failed :(
Opening video decoder: [theora] Theora/VP3
VDec: vo config request - 400 x 400 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [xv] 400x400 => 712x400 Planar YV12 
Selected video codec: [theora] vfm: theora (Theora (free, reworked VP3))


Playing movienew-wide640x480.ogg.
[Ogg] stream 0: video (Theora v3.2.1), -vid 0
Ogg file format detected.
VIDEO:  [theo]  640x480  24bpp  15.000 fps    0.0 kbps ( 0.0 kbyte/s)
xscreensaver_disable: Could not find XScreenSaver window.
GNOME screensaver disabled
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
[theora @ 0x892a230]Missing extradata!
Could not open codec.
VDecoder init failed :(
Opening video decoder: [theora] Theora/VP3
VDec: vo config request - 640 x 480 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 2.37:1 - prescaling to correct movie aspect.
VO: [xv] 640x480 => 1138x480 Planar YV12 
Selected video codec: [theora] vfm: theora (Theora (free, reworked VP3))

Playing movienew-wide800x400.ogg.
[Ogg] stream 0: video (Theora v3.2.1), -vid 0
Ogg file format detected.
VIDEO:  [theo]  800x400  24bpp  15.000 fps    0.0 kbps ( 0.0 kbyte/s)
xscreensaver_disable: Could not find XScreenSaver window.
GNOME screensaver disabled
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
[theora @ 0x892a230]Missing extradata!
Could not open codec.
VDecoder init failed :(
Opening video decoder: [theora] Theora/VP3
VDec: vo config request - 800 x 400 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 3.56:1 - prescaling to correct movie aspect.
VO: [xv] 800x400 => 1422x400 Planar YV12 
[ASPECT] Warning: No suitable new res found!
Selected video codec: [theora] vfm: theora (Theora (free, reworked VP3))


ETHEORA_ASPECT_PRESERVE
-----------------------


Playing movienew-pre400x400.ogg.
[Ogg] stream 0: video (Theora v3.2.1), -vid 0
Ogg file format detected.
VIDEO:  [theo]  400x400  24bpp  15.000 fps    0.0 kbps ( 0.0 kbyte/s)
xscreensaver_disable: Could not find XScreenSaver window.
GNOME screensaver disabled
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
[theora @ 0x892a230]Missing extradata!
Could not open codec.
VDecoder init failed :(
Opening video decoder: [theora] Theora/VP3
VDec: vo config request - 400 x 400 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.00:1 - prescaling to correct movie aspect.
VO: [xv] 400x400 => 400x400 Planar YV12 
Selected video codec: [theora] vfm: theora (Theora (free, reworked VP3))

  
Playing movienew-pre640x480.ogg.
[Ogg] stream 0: video (Theora v3.2.1), -vid 0
Ogg file format detected.
VIDEO:  [theo]  640x480  24bpp  15.000 fps    0.0 kbps ( 0.0 kbyte/s)
xscreensaver_disable: Could not find XScreenSaver window.
GNOME screensaver disabled
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
[theora @ 0x892a230]Missing extradata!
Could not open codec.
VDecoder init failed :(
Opening video decoder: [theora] Theora/VP3
VDec: vo config request - 640 x 480 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [xv] 640x480 => 854x480 Planar YV12 
Selected video codec: [theora] vfm: theora (Theora (free, reworked VP3))


Playing movienew-pre800x400.ogg.
[Ogg] stream 0: video (Theora v3.2.1), -vid 0
Ogg file format detected.
VIDEO:  [theo]  800x400  24bpp  15.000 fps    0.0 kbps ( 0.0 kbyte/s)
xscreensaver_disable: Could not find XScreenSaver window.
GNOME screensaver disabled
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
[theora @ 0x892a230]Missing extradata!
Could not open codec.
VDecoder init failed :(
Opening video decoder: [theora] Theora/VP3
VDec: vo config request - 800 x 400 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 4.00:1 - prescaling to correct movie aspect.
VO: [xv] 800x400 => 1600x400 Planar YV12 
[ASPECT] Warning: No suitable new res found!
Selected video codec: [theora] vfm: theora (Theora (free, reworked VP3))




Hope these tests can be useful... 

> 
> Thanks for bug reporting.
> 
> On Fri, Feb 29, 2008 at 3:44 PM, Manuel Dahmen
> <manuel.dahmen at gmail.com> wrote:
> > On Fri, 29 Feb 2008 09:55:22 -0800
> >  Ralph Giles <giles at xiph.org> wrote:
> >
> >  > On 29-Feb-08, at 2:19 AM, Manuel Dahmen wrote:
> >  >
> >  > > And when I play the movie with mplayer or totem, the video
> >  > > resolution is changed from 640x480 to 854x480 (when i use
> >  > > ETHEORA_ASPECT_NORMAL in etheora_enc_setup).
> >  >
> >  > This is a bug in etheora. It's passing the frame aspect ratio
> >  > where libtheora expects the pixel aspect ratio, which is why it
> >  > looks stretched.
> >  >
> >  > For 640x480 computer-sourced video like processing produces, the
> >  > pixels are square anyway, but ETHEORA_ASPECT_PRESERVE is
> >  > unfortunately also wrong (it sets a square frame aspect ratio).
> >  > So you'll just have to wait until the bug is fixed.
> >  >
> >  > (if you want to hack it, change the default aspect_numerator and
> >  > aspect_denominator in etheora.c to 1 and use ASPECT_PRESERVE.)
> >  >
> >  >   -r
> >
> >  Thank you, -r.
> >
> >  I'll take a look at etheora.c and try to find a solution.
> >
> >  Bye.
> >
> >
> >  > _______________________________________________
> >  > theora mailing list
> >  > theora at xiph.org
> >  > http://lists.xiph.org/mailman/listinfo/theora
> >
> >
> >  --
> >  Manuel Dahmen
> >
> >
> > _______________________________________________
> >  theora mailing list
> >  theora at xiph.org
> >  http://lists.xiph.org/mailman/listinfo/theora
> >


-- 
Manuel Dahmen


More information about the theora mailing list