LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   mplayer OpenGL video output driver too slow (https://www.linuxquestions.org/questions/linux-software-2/mplayer-opengl-video-output-driver-too-slow-694320/)

runesvend 01-01-2009 05:09 PM

mplayer OpenGL video output driver too slow
 
Hello all

I'm experiencing a problem using the OpenGL video output driver when watching HD contents. The same problem is described in this thread but it seems a solution was never found.

The only way, as far as I know, that I can get video playback without video tearing is by using the gl video output driver in mplayer.

Unfortunately, using this video output causes video playback to be too slow. The thing is, I don't understand why it is slow.

I have a fairly powerful CPU (Quad Core 2.83 GHz) and GPU (ATI Radeon HD 3870).

I can see when playing the video and monitoring CPU usage that it isn't the CPU that is the problem. It never gets to 100% CPU usage on either of the cores.

This is the command I'm using:

Code:

mplayer -vo gl -ao alsa -vc coreserver -cache 20000 -demuxer lavf -fs <file.ts>
Why is it so slow?

I've tried using the default demuxer, increasing cache size, the -nosound option but none of these things causes it to be able to keep up.

Here's the output of mplayer from running the above command:

Code:

rune@runescomp:~$ mplayer -vo gl -ao alsa -vc coreserver -cache 20000 -demuxer lavf -fs 1080p-test.ts
MPlayer dev-SVN-r28207-4.2.4 (C) 2000-2008 MPlayer Team
CPU: Intel(R) Core(TM)2 Quad  CPU  Q9550  @ 2.83GHz (Family: 6, Model: 23, Stepping: 7)
CPUflags:  MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 SSE SSE2
129 audio & 259 video codecs
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing 1080p-test.ts.
Cache fill: 13.32% (2727936 bytes) 
libavformat file format detected.
LAVF: Program 1
[lavf] Video stream found, -vid 0
[lavf] Audio stream found, -aid 1
VIDEO:  [H264]  1920x1080  0bpp  23.976 fps    0.0 kbps ( 0.0 kbyte/s)
[gl] using extended formats. Use -vo gl:nomanyfmts if playback fails.
==========================================================================
Forced video codec: coreserver
Opening video decoder: [dshowserver] DirectShowServer video codecs
Opening device
Called unk_IsDebuggerPresent
len: 992
ProductVersion: 1.7.0
Decoder supports the following YUV formats: YUY2 UYVY YV12 I420
Decoder is capable of YUV output (flags 0x2b)
Setting fmt
Starting
Initialization is complete
Dshowserver Connected to host
VDec: vo config request - 1920 x 1080 (preferred colorspace: Packed YUY2)
[PP] Using codec's postprocessing, max q = 4.
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
[swscaler @ 0x8d7d970]using unscaled yuv420p -> rgb32 special converter
VO: [gl] 1920x1080 => 1920x1080 BGRA  [fs]
[ASPECT] Warning: No suitable new res found!
[ASPECT] Warning: No suitable new res found!
Found DirectShow filterSelected video codec: [coreserver] vfm: dshowserver (CoreAVC DShow H264 decoder 1.3 for x86 - http://corecodec.org/)
==========================================================================
==========================================================================
Opening audio decoder: [liba52] AC3 decoding with liba52
Using SSE optimized IMDCT transform
Using MMX optimized resampler
AUDIO: 48000 Hz, 2 ch, s16le, 448.0 kbit/29.17% (ratio: 56000->192000)
Selected audio codec: [a52] afm: liba52 (AC3-liba52)
==========================================================================
AO: [alsa] 48000Hz 2ch s16le (2 bytes per sample)
Starting playback...
[ASPECT] Warning: No suitable new res found!
[ASPECT] Warning: No suitable new res found!
pts value <= previous: -0.757 ct: -0.004  0/  0 ??% ??% ??,?% 1 0 91%
pts value <= previous: -0.679 ct: -0.017  0/  0 ??% ??% ??,?% 2 0 88%
pts value <= previous: -0.587 ct: -0.029  0/  0 23% 82%  5.1% 2 0 85%
pts value <= previous: -0.491 ct: -0.042  0/  0 19% 81%  5.2% 2 0 81%
pts value <= previous: -0.395 ct: -0.054  0/  0 17% 82%  4.8% 2 0 78%
pts value <= previous: -0.299 ct: -0.067  0/  0 15% 82%  4.5% 2 0 75%
pts value <= previous: -0.153 ct: -0.071  0/  0 15% 86%  5.0% 2 0 73%
pts value <= previous: -0.084 ct: -0.075  0/  0 16% 91%  5.2% 2 0 72%
pts value <= previous: -0.023 ct: -0.079  0/  0 16% 96%  5.5% 3 0 71%
pts value <= previous:  0.045 ct: -0.083  0/  0 17% 101%  5.6% 4 0 70%
pts value <= previous:  0.104 ct: -0.088  0/  0 17% 105%  5.9% 5 0 68%
pts value <= previous:  0.163 ct: -0.092  0/  0 17% 109%  5.9% 6 0 68%
pts value <= previous:  0.222 ct: -0.096  0/  0 18% 113%  6.2% 7 0 67%
pts value <= previous:  0.283 ct: -0.100  0/  0 18% 118%  6.4% 8 0 66%
pts value <= previous: -0.006 ct: -0.108  0/  0 14% 94%  5.0% 10 0 64%
A:2736.9 V:2735.9 A-V:  1.005 ct: -0.268  0/  0 14% 116%  5.6% 50 0 49%

          ************************************************
          **** Your system is too SLOW to play this!  ****
          ************************************************

Possible reasons, problems, workarounds:
- Most common: broken/buggy _audio_ driver
  - Try -ao sdl or use the OSS emulation of ALSA.
  - Experiment with different values for -autosync, 30 is a good start.
- Slow video output
  - Try a different -vo driver (-vo help for a list) or try -framedrop!
- Slow CPU
  - Don't try to play a big DVD/DivX on a slow CPU! Try some of the lavdopts,
    e.g. -vfm ffmpeg -lavdopts lowres=1:fast:skiploopfilter=all.
- Broken file
  - Try various combinations of -nobps -ni -forceidx -mc 0.
- Slow media (NFS/SMB mounts, DVD, VCD etc)
  - Try -cache 8192.
- Are you using -cache to play a non-interleaved AVI file?
  - Try -nocache.
Read DOCS/HTML/en/video.html for tuning/speedup tips.
If none of this helps you, read DOCS/HTML/en/bugreports.html.

************736.7 A-V:  1.392 ct: -0.277  0/  0 13% 118%  5.5% 69 0 49%
in-frames: 100 out-frames: 90
************
Destroying filter
Exiting... (Quit)


Agrouf 01-02-2009 10:10 AM

Are you using a compositing window manager and which ati driver are you using?

runesvend 01-02-2009 12:21 PM

Hello!

I'm using ATI's binary "fglrx"-driver. Installed with the "xorg-driver-fglrx"-package in Ubuntu:

Code:

rune@runescomp:~/Desktop$ dpkg --list | grep fglrx
ii  fglrx-amdcccle                            2:8.561-0ubuntu1                                    Catalyst Control Center for the ATI graphics
ii  fglrx-kernel-source                        2:8.561-0ubuntu1                                    Kernel module source for the ATI graphics ac
ii  xorg-driver-fglrx                          2:8.561-0ubuntu1                                    Video driver for the ATI graphics accelerato

I can see that I have metacity running:

Code:

rune@runescomp:~/Desktop$ ps -Af | grep metacity
rune    15781 15690  0 18:51 ?        00:00:01 /usr/bin/metacity --sm-client-id=default0
rune    17201 15923  0 19:17 pts/0    00:00:00 grep metacity

But I don't know how to disable this, if it's possible. I'm running Ubuntu, and I've set the "Visual Effects" to "None" under System>Preferences>Appearance.

This is what my xorg.conf looks like:

Code:

# xorg.conf (X.Org X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the xorg.conf manual page.
# (Type "man xorg.conf" at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
#  sudo dpkg-reconfigure -phigh xserver-xorg

Section "ServerLayout"
        Identifier    "Default Layout"
        Screen      0  "aticonfig-Screen[0]-0" 0 0
EndSection

Section "Files"
EndSection

Section "Module"
EndSection

Section "ServerFlags"
        Option            "AIGLX" "off"
EndSection

Section "InputDevice"
        Identifier  "Generic Keyboard"
        Driver      "kbd"
        Option            "XkbRules" "xorg"
        Option            "XkbModel" "pc105"
        Option            "XkbLayout" "dk"
        Option            "XkbOptions" "lv3:ralt_switch"
EndSection

Section "InputDevice"
        Identifier  "Configured Mouse"
        Driver      "mouse"
        Option            "CorePointer"
EndSection

Section "Monitor"
        Identifier  "aticonfig-Monitor[0]-0"
        HorizSync    30.0 - 115.0
        VertRefresh  50.0 - 160.0
        Option            "VendorName" "ATI Proprietary Driver"
        Option            "ModelName" "Generic Autodetecting Monitor"
        Option            "DPMS" "true"
#        Modeline        "1600x1200"x85.0  235.00  1600 1728 1896 2192  1200 1203 1207 1262 -hsync +vsync
EndSection

Section "Device"
        Identifier  "aticonfig-Device[0]-0"
        Driver      "fglrx"
        Option            "UseInternalAGPGART" "no"
        Option            "VideoOverlay" "on"
        Option            "OpenGLOverlay" "off"
        Option            "MonitorLayout" "AUTO, AUTO"
        Option            "Capabilities" "0x00000800"
        Option            "TexturedVideoSync" "on"
        BusID      "PCI:1:0:0"
EndSection

Section "Screen"
        Identifier "aticonfig-Screen[0]-0"
        Device    "aticonfig-Device[0]-0"
        Monitor    "aticonfig-Monitor[0]-0"
        DefaultDepth    24
        SubSection "Display"
                Viewport  0 0
                Depth    24
                Modes    "1600x1200"
        EndSubSection
EndSection

Section "Extensions"
        Option            "Composite" "1"
#        Option        "RENDER"        "1"
EndSection


runesvend 01-02-2009 12:33 PM

After reading a bit I don't think I'm using a compositing window manager. I think the compositing in metacity is disabled because the value of "/apps/metacity/general/compositing_manager" is set to "false" in the gconf-editor:

Code:

rune@runescomp:~/Desktop$ gconftool-2 -g '/apps/metacity/general/compositing_manager'
false


runesvend 01-03-2009 02:49 PM

Hey Agrouf, the next time just tell me to RTFM :)

Under the OpenGL video output driver section the following added options were suggested:

Code:

-vo gl:yuv=2:rectangle=2
It turns out that YUV to RGB conversion is done in software by default, setting the option "yuv" to 2 makes the GPU do this work with all its hardware accelerated fanciness. Setting "rectangle" to 2 also makes the GPU take over some work, at least that's what I think because it runs faster with this option, but I don't know what it actually does. From the mplayer man page:

Code:

rectangle=<0,1,2>
    Select usage of rectangular textures which saves video RAM, but often is slower (default: 0).
        0: Use power-of-two textures (default).
        1: Use the GL_ARB_texture_rectangle extension.
        2: Use the GL_ARB_texture_non_power_of_two extension.  In some cases only supported in software and thus very slow.

Using these options instead of the defaults enables me to achieve 39 FPS instead of 16 FPS:

Code:

-vo gl
mplayer -benchmark -frames 500 -vo gl -nosound -vc coreserver -cache 20000 -fs -ss 120 "1080p-test.mkv"
BENCHMARKs: VC:  2.411s VO:  28.989s A:  0.000s Sys:  0.313s =  31.713s
BENCHMARK%: VC:  7.6034% VO: 91.4105% A:  0.0000% Sys:  0.9861% = 100.0000%
15.77 FPS

-vo gl:yuv=2:rectangle=2
mplayer -benchmark -frames 500 -vo gl:yuv=2:rectangle=2 -nosound -vc coreserver -cache 20000 -fs -ss 120 "1080p-test.mkv"
BENCHMARKs: VC:  2.384s VO:  10.211s A:  0.000s Sys:  0.189s =  12.783s
BENCHMARK%: VC: 18.6503% VO: 79.8749% A:  0.0000% Sys:  1.4748% = 100.0000%
39.11 FPS



All times are GMT -5. The time now is 12:46 PM.