![]() |
downloads | documentation | HowTo | reporting bugs | links | Recent Changes |
What is a Wiki?See WikiWikiWeb If you don't know how to use a wiki see the WikiHowto ErfurtWiki is maintained by a loosely knit group of developers. Quick LinksRelated sitesContactPlease submit website bugs in the BugReports Contribute!Please file any wishes on UserSuggestions. Hosted By |
Hardware Accelerated Video with VDPAUNVIDIA has recently (12/08) released its 180 series Linux drivers featuring VDPAU, a Linux equivalent of PureVideo? on Windows. With VDPAU, you get hardware decoding of H.264, MPEG, WMV3 and VC1 video once you've installed the proper drivers and a video player which can utilize them. Here is how to get everything up and running. Note: This will only work on NVIDIA 8-series and above cards, generally any card that is labeled DirectX 10 compatible will work. The README distributed with the driver contains a list of supported cards, or you can refer to this thread on nvnews.net for a list: http://www.nvnews.net/vbulletin/showthread.php?t=123091 INSTALLING FOR R6:LinHES/KnoppMyth R6 has the necessary drivers and version of mplayer already in its package repositories. So, to install for R6, All you need to do is issue the following command as root: # pacman -Sy mplayer-vdpau Then from the root menu: Service Menu -> MythTV Configuration -> Setup -> Media Settings -> Videos Settings -> Player Settings -> Change the default video player to "mplayer-resumer-vdpau.pl %s" (Yep, no parms whatsoever other than '%s') Tips:You may want to modify /usr/LH/bin/vdpau-detector to ouput a different aspect ratio than the hardcoded 16:10, find & replace all occurrences of "16:10" in that file. Also, I had to modify /usr/LH/bin/mplayer-resumer-vdpau.pl & change my $mplayeropts=`./vdpau-detector $infile`; chomp $mplayeropts; to my $mplayeropts=`/usr/LH/bin/vdpau-detector $infile`; chomp $mplayeropts; OLD INSTRUCTIONS:Step 1: Update drivers to 180.xDownload the driver from the here: http://www.nvidia.com/object/unix.html. Install as usual. If you haven't updated NVIDIA drivers before, the process basically consists of stopping X ("init 3; killall -9 xinit"), executing the downloaded file as root (sh NVIDIA-Linux-etc.run) and restarting X once it's installed (init 5). Step 2: Compile and install mplayer patched for VDPAUDownload the VDPAU patch from here: ftp://download.nvidia.com/XFree86/vdpau/. Extract the tarball to a convenient directory such as /usr/src. Once you have extracted it, there will be a shell script named "checkout-patch-build.sh" in the directory it creates. Run that shell script and it will automatically check out the mplayer sources from svn, patch them for VDPAU, and build mplayer. Step 3: Test it outIf you wish, you can download and play some sample videos. Change to the directory where you compiled mplayer (for example /usr/src/mplayer-vdpau-version/mplayer-vdpau) and run mplayer from there. Links to sample videos encoded with H.264, MPEG2, WMV3 and VC1 are included in the README file of NVIDIA's tarball, however, last I looked most of the links were dead. You most likely at least have some H.264 and MPEG2 videos in your library, and DVD video is encoded with MPEG2, so you could test it with a DVD as well. Step 4: Install and set up MythTV to use itFirst, rename your existing mplayer resume help to /usr/bin/mplayer_orig, then copy the mplayer binary from the build directory to /usr/bin (do not do this on R6, obviously). Next, you will need to install the following script to /usr/local/bin. This script will determine the codec used to encode the video and set the mplayer options accordingly. I have set it up to only use VDPAU for DVD and above resolution videos, and use standard XV output for all videos encoded at a lower resolution or with a non-VDPAU-supported codec (such as DivX or XviD). Here is the script: mplayer_vdpau.sh
#!/bin/bash
IAM=$0
FILE=$1
#if no input display usage
if [[ -z "$FILE" ]]; then
echo usage: $0 /path/to/file
exit
fi
MPLAYER=/usr/bin/mplayer
# Options for all videos: fullscreen, SPDIF passthrough DTS/AC3
BASIC_OPTS="-fs -zoom -quiet -ao alsa:device=iec958 -ac hwdts,hwac3,"
# Options for non-HD videos: force aspect to 16x9 (to ensure video fills TV screen)
NOHD_OPTS="-aspect 16:9"
# Options for normal and lowres videos: use XV w/deinterlace filter, force 16x9
LOW_OPTS="-aspect 16:9 -vf yadif=3:1 -pp 0x33 -vo xv"
VWIDTH=$($MPLAYER -identify -vo vdpau -frames 0 "$FILE" | grep ID_VIDEO_WIDTH | cut -c 16-25)
VCODEC=$($MPLAYER -identify -vo vdpau -frames 0 "$FILE" | grep ID_VIDEO_CODEC | cut -c 16-25)
# all following echo commands can be uncommented for debug info
#echo "VIDEO CODEC: $VCODEC"
#echo "VIDEO WIDTH: $VWIDTH"
# Test for codec, if it's supported by VDPAU, set options to use it. Then, check if the video is in HD,
# and if it's not, set non-HD options.
case $VCODEC in
ffh264)
#echo -e "Playing h.264 file $FILE:\n"
MPLAYEROPTS="$BASIC_OPTS -vo vdpau -vc ffh264vdpau"
if [ $VWIDTH -lt 1280 ] && [ $VWIDTH != 0 ]; then
MPLAYEROPTS="$MPLAYEROPTS $NOHD_OPTS"
fi
if [ $VWIDTH -lt 700 ] && [ $VWIDTH != 0 ]; then
MPLAYEROPTS="$BASIC_OPTS $LOW_OPTS"
fi
;;
ffmpeg2)
#echo -e "Playing MPEG2 file $FILE:\n"
MPLAYEROPTS="$BASIC_OPTS -vo vdpau -vc ffmpeg12vdpau"
if [ $VWIDTH -lt 1280 ] && [ $VWIDTH != 0 ]; then
MPLAYEROPTS="$MPLAYEROPTS $NOHD_OPTS"
fi
if [ $VWIDTH -lt 700 ] && [ $VWIDTH != 0 ]; then
MPLAYEROPTS="$BASIC_OPTS $LOW_OPTS"
fi
;;
ffwmv3)
#echo -e "Playing WMV3 file $FILE:\n"
MPLAYEROPTS="$BASIC_OPTS -vo vdpau -vc ffwmv3vdpau"
if [ $VWIDTH -lt 1280 ] && [ $VWIDTH != 0 ]; then
MPLAYEROPTS="$MPLAYEROPTS $NOHD_OPTS"
fi
if [ $VWIDTH -lt 700 ] && [ $VWIDTH != 0 ]; then
MPLAYEROPTS="$BASIC_OPTS $LOW_OPTS"
fi
;;
# VC-1 is largely unsupported by nvidia - uncomment this section if you're sure your card supports it.
ffvc1)
#echo -e "Playing VC-1 file $FILE:\n"
MPLAYEROPTS="$BASIC_OPTS -vo vdpau -vc ffvc1vdpau"
if [ $VWIDTH -lt 1280 ] && [ $VWIDTH != 0 ]; then
MPLAYEROPTS="$MPLAYEROPTS $NOHD_OPTS"
fi
if [ $VWIDTH -lt 700 ] && [ $VWIDTH != 0 ]; then
MPLAYEROPTS="$BASIC_OPTS $LOW_OPTS"
fi
;;
*)
#echo -e "Playing normal file $FILE:\n"
# Use XV and yadif filter with 'normal' (DiVX, XViD, old WMV, etc.) files, and force 16:9
# -vf filters only seem to work with XV, or at least they don't work w/VDPAU
MPLAYEROPTS="$BASIC_OPTS $LOW_OPTS"
;;
esac
#echo "mplayer options are: $MPLAYEROPTS"
$MPLAYER $MPLAYEROPTS "$FILE"
Once the script is installed to /usr/local/bin (be sure to make it executable with "chmod +x mplayer_vdpau.sh"), go to MythTV setup and set your default video player to "mplayer_vdpau.sh %s". Note the comment for the VC-1 section: I've uncommented it since my card supports VC-1 hardware decoding, but most cards don't. If yours doesn't, comment that section out. I've also set it up to always expand videos to 16x9, use DTS/AC3 passthrough over SPDIF, and to use mplayer's deinterlacing filter for normal (everything but H.264/MPEG/WMV3/VC-1) and low-res videos, if you want to change this, tweak the BASIC_OPTS, NOHD_OPTS and LOW_OPTS variables in the script. Final notes:The patched mplayer is still somewhat buggy when using VDPAU output, there are issues with subtitles and OSD, and it may crash when skipping back and forth through videos. You also may get the following error on certain videos, I've only seen it on high-bitrate 1080p H.264 videos in Matroska containers: Error 25 at libvo/vo_vdpau.c:992 If you get that error, edit the file libvo/vo_vdpau.c in the mplayer build directory, and change line 704 to the following: max_references = ((12 * 1024 * 1024) / surf_size) + 4; Once changed, recompile mplayer ("make clean; make"). Adding the "+ 4" makes it work with all the videos I have. If it still crashes on some of your videos, try changing it to a higher number, I've heard of people changing it to as high as + 11. This is a dirty hack, but it works. The bug will probably be fixed in newer versions of the patch (the latest as of this writing was released on 12/23/08). As far as performance, in my experience anyway the performance gains are quite substantial. I used to get "Your system is too SLOW to play this" warnings with 1080p H.264 videos at high bitrates (15-20mbps), even though I have a fast Core Duo, 3GB RAM and a 512MB PCIe x16 video card. With VDPAU, I get no such warnings, and videos that used to stutter or slow down during scenes with a lot of motion no longer do so. mplayer's CPU load also drops by as much as 50% on some videos. EditThisPage BackLinks PageInfo Pages like this Attachments RSS/Atom last changed on Tue Jul 27 09:15:10 2010 |
UpdatedPages· WhatRemoteYouUse last changed on Sat Jul 31 10:46:47 2010· WhatCardYouUse last changed on Sat Jul 31 10:45:00 2010 · TinnyAudioPVR150 last changed on Fri Jul 30 03:20:30 2010 · KnoppMythWiki last changed on Thu Jul 29 04:35:17 2010 · HowTo last changed on Wed Jul 28 09:27:02 2010 · HardwareAcceleratedVideo last changed on Tue Jul 27 09:15:10 2010 · MythVodkaHowTo last changed on Tue Jul 27 09:14:04 2010 · DisklessFrontend last changed on Tue Jul 27 09:13:29 2010 · CompileMythTVFromSVN last changed on Tue Jul 27 07:39:28 2010 · MythMusic last changed on Tue Jul 27 07:38:00 2010 · RRD Disk Partition Usage last changed on Sun Jul 25 21:34:12 2010 · UserSuggestions last changed on Sun Jul 25 16:25:51 2010 · Links last changed on Sun Jul 25 16:21:33 2010 · KnoppmythDownloads last changed on Sun Jul 25 14:02:11 2010 · KnoppMythInstall last changed on Sun Jul 25 14:00:46 2010 · TroubleShooting last changed on Wed Jul 21 07:03:13 2010 · webminhowto last changed on Mon Jul 19 07:34:28 2010 · PickingComponents last changed on Wed Jul 14 17:27:40 2010 · mplayerResume last changed on Mon Jul 12 22:54:24 2010 · R5A12DvdRipping last changed on Mon Jul 12 14:44:04 2010 · Additional Software last changed on Mon Jul 12 14:42:31 2010 · HowToUseMyth last changed on Mon Jul 12 14:41:09 2010 · x11vncHowTo last changed on Sun Jul 11 00:06:20 2010 · CountrySpecific last changed on Thu Jul 1 14:48:40 2010 · RepairingMythConvergDB last changed on Thu Jul 1 14:42:58 2010 · tv_grab_au last changed on Tue Jun 29 15:44:05 2010 |
| sitemap | | |