I have a laptop with a discrete Nvidia graphics card .
How can I know if my video player be it mplayer or vlc or totem is using nvidia VDPAU or not?
For example, running mplayer2 with the script below, I get this message:
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
But I do have such file in the system:
-rw-r--r-- 1 root root 1800952 2011-11-23 07:39 /usr/lib/nvidia-current/vdpau/libvdpau_nvidia.so.290.10
Script to find out codec for a file:
#!/bin/bash
#Script to automatically find out which codec a file is using and determine whether or not to use VDPAU.
#if no input display usage
if [ -z "$1" ]; then
echo usage: $0 /path/to/file
exit
fi
#remember to change this to the path of your mplayer binary
mplayerlocation=/usr/bin/
cd $mplayerlocation
#kinda a lame way to do it, but bring up mplayer and pipe the output to a temporary file, then read which codec the file is
./mplayer -identify -vo vdpau $1 > /tmp/VIDEOCODEC &
sleep 0.5
killall mplayer
videocodec=`cat /tmp/VIDEOCODEC | grep ID_VIDEO_CODEC | cut -c 16-25`
rm /tmp/VIDEOCODEC
echo "VIDEO CODEC: $videocodec"
if [ $videocodec = "ffh264" ]; then
codec='h264'
echo \n Playing $1 with $codec codec \n
./mplayer -vo vdpau -vc ffh264vdpau $1
exit
fi
if [ $videocodec = "ffmpeg2" ]; then
codec='MPEG2'
echo \n Playing $1 with $codec codec \n
./mplayer -vo vdpau -vc ffmpeg12vdpau $1
exit
fi
if [ $videocodec = "ffwmv3" ]; then
codec='WMV3'
echo \n Playing $1 with $codec codec \n
./mplayer -vo vdpau -vc ffwmv3vdpau $1
exit
fi
#VC1 is not supported on most gpus
#uncomment if it is supported on your gpu
#if [ $videocodec = "ffvc1" ]; then
# codec='VC1'
# echo \n Playing $1 with $codec codec \n
# ./mplayer -vo vdpau -vc ffvc1vdpau $1
#
# exit
#fi
#if it isnt one of those it is not supported by vdpau
#so we should play without vdpau
./mplayer $1
exit
EDIT: apparently it can't find the library, not even when calling it via bumblebee's v3 optirun, although the library is there:
optirun vdpauinfo
display: :0.0 screen: 0
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
Error creating VDPAU device: 1
avilella@magneto:~$ locate libvdpau_nvidia.so | xargs ls
/usr/lib/nvidia-current/vdpau/libvdpau_nvidia.so /usr/lib/nvidia-current/vdpau/libvdpau_nvidia.so.1 /usr/lib/nvidia-current/vdpau/libvdpau_nvidia.so.290.10
EDIT2: I tried again with Ubuntu 12.04 and I still can't get it to work.
Best Answer
To address your question & a bit on enabling gpu decoding with mplayer or vlc.
Mplayer
The easiest way to see if you are getting gpu decoding thru vdpau is to do what you've done - run mplayer from a terminal. Atm what you've shown indicates you're not getting it.
The requisites for mplayer are:
mplayer
ormplayer 2
nvidia-current
or the nvidia drivers directly from nvidia, the nvidia-current package will do.libvdpau
Make sure you've meet the above, then run the command you did before, though make sure the video is h.264
Ex. of terminal output, removed irrelevant lines
If you do support/get vdpau thru mplayer you can set a
vc=
line in~/.mplayer/config
to auto check & use the appropriate ffvdpau* decoder for supported codecsAnother way to check is to use
vdpauinfo
. The package is only available in 12.04 but can be installed in 11.10. To do so go here, download & install withgdebi
, thoughsoftware center
may install for you if you wish to tryhttp://packages.ubuntu.com/precise/vdpauinfo
To use open a terminal & run
vdpauinfo
Ex. of some of the output of vdpauinfo on a laptop with basic vdpau support
Vlc
If you have nvidia hardware & can't or don't have vdpau support then don't bother with vlc which uses vaapi & is tricker to enable. Additionally the performance of vaapi on nvidia is very much hardware dependent. I've enabled here but don't use, ffmpeg multi-thread is better with my hardware in vlc.
This is just the basics of getting vaapi & enabling in vlc. For specifics you'd need to search & or ask how .
The requisites for vlc are:
vlc & ffmpeg shared libs that have vaapi support, 11.10 is good there.
libva1
, also installlibva-x11-1
vainfo
vdpau-va-driver
Your biggest issue may be that ubuntu's versions of libva* & vdpau-va-driver aren't new enough, you'll need to get further advice there.
In 12.04 they are adequate
Running
vainfo
in a terminal should tell you where you standEx. here of vainfo
To enable gpu decoding in vlc thru vaapi & ffmpeg, two ways
From a terminal, no need to set in preferences
To set in vlc's gui, the prior posts are incorrect as to how, actual way is shown in screen
Tools > Preferences > Input/Codecs > check the box, reading up on "Skip H.264 in-loop deblocking filter" may prove worthwhile
Ex. from terminal of vlc gpu decoding thru vaapi, using the repo vlc in 12.04 though 1.2/1.3/2.0 are preferred versions, a ppa for 2.0 should be available if desired