I saw that vlc gets the decoded image back from the graphics cards when using hardware acceleration, e.g. VAAPI. So I thought this should also work as encoding accelerator, so the CPU only has to encode, not decode the video and cause at least some speedup, especially for large video files encoded into small files. I'm using the GMA500 poulsbo chipset for this test with 1,6 Ghz Atom(TM) CPU Z530.
Showing posts with label vaapi. Show all posts
Showing posts with label vaapi. Show all posts
Benchmarking VLC Encoding/Transcoding Speed
If you need to benchmark how fast vlc transcodes a certain file with certain settings, it's a bit tough. It doesn't seem to have any way to display the frames per second (fps) during encoding and no benchmark option as mplayer. A good way to work around this is to check how long it takes vlc to encode a certain file for a few seconds, e.g.
time vlc --stop-time 25 (...) vlc://quit.
e.g. time vlc --stop-time 25 /D/MVI_6615.MOV --sout "#transcode{width=384,height=288,vcodec=h264,acodec=vorbis}:standard{access=file,mux=mkv,dst=test.mkv}}" --sout-x264-crf=24 --sout-transcode-threads=2 vlc://quit
This encodes for 25 seconds and then quits and displays the time it took. Make sure to have vlc://quit at the very end of the command line and after your input file. The "user" value is what matters, this shows how long it kept the cpu occupied. Of course this only works on Unix systems. Also be aware that the second time the input file comes from cache, so only use the values from the second or later encodings for comparison.
time vlc --stop-time 25 (...) vlc://quit.
e.g. time vlc --stop-time 25 /D/MVI_6615.MOV --sout "#transcode{width=384,height=288,vcodec=h264,acodec=vorbis}:standard{access=file,mux=mkv,dst=test.mkv}}" --sout-x264-crf=24 --sout-transcode-threads=2 vlc://quit
This encodes for 25 seconds and then quits and displays the time it took. Make sure to have vlc://quit at the very end of the command line and after your input file. The "user" value is what matters, this shows how long it kept the cpu occupied. Of course this only works on Unix systems. Also be aware that the second time the input file comes from cache, so only use the values from the second or later encodings for comparison.
XBMC with VAAPI on Poulsbo (Intel GMA500) or other VAAPI Systems
It's not possible directly right now due to limitations of the existing GMA 500 drivers (IEGD, PSB, ...) and probably other vaapi drivers. But if you have mplayer-vaapi running, it's really easy - because you can set up xbmc to use external players with XBMC 10.
Setting Up VAAPI Hardware Accelerated Video Decoding for Ubuntu 10.04 (example Intel Poulsbo GMA 500)
(For the more detailed guide for Ubuntu 9.10, which works much better for me, including suspend to ram, see here.)
This is just a really, really short basic howto for setting up the poulsbo X driver and VAAPI video acceleration on Ubuntu 10.04. I will post more details later.
1. Install the poulsbo driver:
sudo add-apt-repository ppa:gma500/ppa
sudo add-apt-repository ppa:gma500/fix
sudo apt-get update
sudo apt-get install poulsbo-driver-3d
2. Set up the Xorg.conf:
3. Reboot, check it's all working.
VAAPI
4. Download the right mplayer version:
wget http://www.splitted-desktop.com/~gbeauchesne/mplayer-vaapi/mplayer-vaapi-20100114.i686.tar.bz2
unp mplayer-vaapi*
5. Install the necessary libraries: (you can remove mplayer then, but it's the easiest method)
sudo apt-get install mplayer libgtop2-7
6. and play
mplayer -vo vaapi -va vaapi testfile.avi
If mplayer doesn't run because of missing libraries, this command will show which libraries are missing:
ldd mplayer-vaapi*/mplayer
Be quick, before the instructions change due to new repositories, libraries, etc... But don't everything to work flawlessly! My system doesn't even go into suspend, but crashes. Hence it can't come out of suspend, either. Backlight control still doesn't work for me. And I still have to do more testing on mplayer to see how smooth VAAPI actually is.
Theoretically, installing VLC 1.1.0 with VAAPI should be as easy as this:
sudo add-apt-repository ppa:c-korn/vlc && sudo apt-get update && sudo apt-get install vlc
But it didn't work out of the box for me and I didn't care about why. If you have hints, questions or - yes- comments, please post in the comments.
This is just a really, really short basic howto for setting up the poulsbo X driver and VAAPI video acceleration on Ubuntu 10.04. I will post more details later.
1. Install the poulsbo driver:
sudo add-apt-repository ppa:gma500/ppa
sudo add-apt-repository ppa:gma500/fix
sudo apt-get update
sudo apt-get install poulsbo-driver-3d
2. Set up the Xorg.conf:
Section "DRI"
Mode 0666
EndSection
Section "Device"
Identifier "GMA500"
Option "AccelMethod" "EXA"
Option "DRI" "on"
Option "MigrationHeuristic" "greedy"
Option "IgnoreACPI" "yes"
Driver "psb"
EndSection
3. Reboot, check it's all working.
VAAPI
4. Download the right mplayer version:
wget http://www.splitted-desktop.com/~gbeauchesne/mplayer-vaapi/mplayer-vaapi-20100114.i686.tar.bz2
unp mplayer-vaapi*
5. Install the necessary libraries: (you can remove mplayer then, but it's the easiest method)
sudo apt-get install mplayer libgtop2-7
6. and play
mplayer -vo vaapi -va vaapi testfile.avi
If mplayer doesn't run because of missing libraries, this command will show which libraries are missing:
ldd mplayer-vaapi*/mplayer
Be quick, before the instructions change due to new repositories, libraries, etc... But don't everything to work flawlessly! My system doesn't even go into suspend, but crashes. Hence it can't come out of suspend, either. Backlight control still doesn't work for me. And I still have to do more testing on mplayer to see how smooth VAAPI actually is.
Theoretically, installing VLC 1.1.0 with VAAPI should be as easy as this:
sudo add-apt-repository ppa:c-korn/vlc && sudo apt-get update && sudo apt-get install vlc
But it didn't work out of the box for me and I didn't care about why. If you have hints, questions or - yes- comments, please post in the comments.
Using SMPlayer with hardware video acceleration such as VAAPI - Fixing various crashes etc. with VAAPI
If you've also tried to use VAAPI with SMplayer, you may also have experienced the crash every single time you try to watch anything. These things might also apply to VDPAU and xvmc.
Here's the solution
1. Disable screenshots:
General -> General -> Enable Screenshots [ ] (uncheck)
2. Set to single thread decoding:
Performance -> Performance -> Threads ... [1]
3. Disable subtitles and postprocessing.
2. Set to single thread decoding:
Performance -> Performance -> Threads ... [1]
3. Disable subtitles and postprocessing.
Here's what doesn't help:
Upgrading to the current version 0.6.8.
If you want to know how to get VAAPI working SMPlayer in the first place: Select
General -> Video -> Output Driver -> Custom -> "vaapi,xv," and
Advanced -> Options for Mplayer -> Options -> "-va vaapi".
Let me know if it worked for you. Someone should probably inform the author of smplayer and/or mplayer. Excellent programs!
How to set up X and VAAPI Accelerated HD Video on the MSI Wind U110 (GMA500 - Poulsbo) and Ubuntu Karmic 9.10
The following guide is now slightly outdated as Ubuntu 10.04 is out and new drivers are necessary, also some of the repositories I originally used have disappeared. If you use Ubuntu 10.04, try following my much easier directions here instead. (The largest detriment to the Ubuntu 9.10 driver is a complete lack of suspend to ram for me. I will leave my guide for 9.10 online as reference, though. It seems to have been the first good description and I'm happy about the major online media coverage. :)
I've finally managed to get it running. Here is what I did. First you need to get Ubuntu 9.10 running with poulsbo. The first steps 1.-4. describe how to set up the driver for X. The second part (5.-10.) describes how to set up VAAPI and mplayer to get video acceleration. (There is already an early stage GMA500 driver for Ubuntu 10.04.)
The image shows the phoronix test suite benchmarking when I play Grey.ts in a loop (-loop 0) with mplayer and vaapi but without sound (-nosound) on my netbook. During the entire time, the CPU frequency is also downscaled to 800 Mhz. Compare to phoronix vdpau benchmark on a core 2 duo system (which obviously shows even less cpu usage, because the CPU is much more powerful) or the Atom and Nvidia ION benchmark on Phoronix.
The only real problem is with suspend to ram. You can't use suspend to ram or VAAPI at the same time: If you used VAAPI and try to suspend, the system doesn't suspend and/or crashes. If you suspend, then use VAAPI or even xv I think, the system crashes really hard. So suspend doesn't really work as expected yet. I think the sound also doesn't work properly after suspend. Suspend works fine for me even after resume if I do a double console switch (Ctrl-Alt-F1 wait until you see the console, then Ctrl-Alt-F7).
VAAPI Video Acceleration setup
I've finally managed to get it running. Here is what I did. First you need to get Ubuntu 9.10 running with poulsbo. The first steps 1.-4. describe how to set up the driver for X. The second part (5.-10.) describes how to set up VAAPI and mplayer to get video acceleration. (There is already an early stage GMA500 driver for Ubuntu 10.04.)
The image shows the phoronix test suite benchmarking when I play Grey.ts in a loop (-loop 0) with mplayer and vaapi but without sound (-nosound) on my netbook. During the entire time, the CPU frequency is also downscaled to 800 Mhz. Compare to phoronix vdpau benchmark on a core 2 duo system (which obviously shows even less cpu usage, because the CPU is much more powerful) or the Atom and Nvidia ION benchmark on Phoronix.
CPU usage when playing a 10 minute fireworks recording in 1080p @ 50 fps without sound and then two FullHD movie trailers. The CPU is clocked at 800Mhz the entire time. The spike is caused by a bug in my test sequence: I didn't start a new mplayer process for new files but passed them all at once on the command line.
I can watch FullHD (1080p @ 50 fps + AC3) videos with about 30% or less CPU utilization (Atom@800 Mhz) on my netbook now. Looks really nice, too. Some videos produce artefacts, especially self-recorded AVCHD m2ts files. If you use the right demuxer, AVCHD videos play fine, but deinterlacing does not work. Sometimes the video seems not to run very smooth, etc. It's not perfect yet, don't expect too much! But most videos work perfectly, no matter what resolution.
Here's what you need to do
1. Basically you add the GMA500 Repositories for Ubuntu 9.10 (karmic) and 10.04 (Lucid) to /etc/apt/sources.list.d/mobile.list. (If the entry below doesn't work, check this page.)
sudo add-apt-repository ppa:gma500/ppa && sudo apt-get update
2. Then you install the poulsbo-driver-3d including the firmware and everything.
2.a. Check if you can load the psb module: sudo modprobe psb. If you see this in dmesg instead of a switch to the correct resolution,
2.a. Check if you can load the psb module: sudo modprobe psb. If you see this in dmesg instead of a switch to the correct resolution,
"kernel BUG: unable to handle kernel NULL pointer dereference at (null)" (2.6.31)
you need a manual hack to get the driver working, as I just reported.
3. Once that's done, for a more stable and speedy operation, you need to add an /etc/X11/xorg.conf:
Section "Device"Identifier "GMA500"Option "AccelMethod" "EXA"# someone suggested UXA? but that's for the i965 driversOption "DRI" "on"Option "MigrationHeuristic" "greedy"Option "IgnoreACPI" "yes"Driver "psb"EndSection
Section "DRI"Mode 0666EndSection
4. Reboot and make sure that it works! If X doesn't work properly yet, VAAPI won't, either. After a short black screen, you should be greeted in the correct resolution. Full screen xv video should already work fine. Suspend to RAM also worked perfectly at this point for me.
If the system goes to DPMS standby and from there switches to other modes (DPMS suspend, etc.), then my screen actually turns on again (showing all black with backlight active). So make sure you chose only one setting for DPMS. A constantly running screen is not good at all.
If the system goes to DPMS standby and from there switches to other modes (DPMS suspend, etc.), then my screen actually turns on again (showing all black with backlight active). So make sure you chose only one setting for DPMS. A constantly running screen is not good at all.
VAAPI Video Acceleration setup
Now comes the part where we install the hardware decoding acceleration. If you just want X you can stop now. ;) This is written for Ubuntu 9.10 with old repositories, so 5+6 might not be necessary anymore or work for Ubuntu 10.04!
5. Install the Libva library from http://www.splitted-desktop.com/~gbeauchesne/libva/pkgs/i386/libva1_0.31.0-1+sds8_i386.deb. This replaces your current libva1 with a newer version. also works for me. Don't forget to install the -dev version (http://www.splitted-desktop.com/~gbeauchesne/libva/pkgs/i386/libva-dev_0.31.0-1+sds8_i386.deb) as well if you want to compile mplayer later.
wget http://www.splitted-desktop.com/~gbeauchesne/libva/pkgs/i386/libva1_0.31.0-1+sds8_i386.deb
http://www.splitted-desktop.com/~gbeauchesne/libva/pkgs/i386/libva-dev_0.31.0-1+sds8_i386.deb&& sudo dpkg -i libva1_0.31.0*i386.deb
6. Create a link of your video driver to the vaapi driver directory:
sudo ln -s /usr/X11R6/lib/modules/dri/psb_drv_video.so /usr/lib/va/drivers/
A. Precompiled setup. (You can alternatively skip to part B: compiling the source code setup)
7. Download and unpack the precompiled mplayer:
8. Install a normal mplayer and libmad with apt-get.
sudo apt-get install mplayer libmad0
9. Unpack mplayer and create necessary links to the libraries it expects.
"ldd mplayer" tells you what library (names) mplayer expects.
Just to go /usr/lib and create links to them:
e.g
ln -s libx264.so.67 libx264.so.65
This should work as long as your libraries are newer than the expected ones. It may actually work out of the box in Ubuntu Jaunty.
10. Start mplayer from the package you downloaded:
e.g. ~/mplayer-vaapi-20090914.i686/mplayer -fs -vo vaapi -va vaapi HDtest.avi
B. Compiling the Source Code
I've also manged to get the source code to work. This is less bothersome, because you need not link the libaries. Hence less man hours, but more disk space and computer hours for compiling. Didn't take as long as I feared, though. And it's using a slightly newer version of mplayer-vaapi, which includes some rudimentary OSD in vaapi mode now.
7. Install the build environment:
sudo apt-get build-dep mplayersudo apt-get install libdrm-devwget http://www.splitted-desktop.com/~gbeauchesne/libva/pkgs/i386/libva-dev_0.31.0-1+sds8_i386.deb && sudo dpkg -i libva-dev_0.31.0-1+sds8_i386.debmaybe: sudo apt-get -f install
8. Download the source at http://www.splitted-desktop.com/~gbeauchesne/mplayer-vaapi/mplayer-vaapi-20091106-FULL.tar.bz2. Unpack it and execute the checkout-patch-build.sh.
9. Check if it works, e.g.
mplayer -fs -vo vaapi -va vaapi ~/HDtest.avi
10.
sudo make install.
X. Done! Enjoy e.g. a nice HD trailer for a start! Post your results! I can recommend using it in smplayer for more comfort(e.g. automatically continue where you left of last). If it crashed, check out by blog entry about smplayer crashing in vaapi mode.
Update: It turns out deinterlacing not working is not due to VAAPI, but a limit in the psb driver. It works with the current iegd driver and other drivers from AMD and NVIDIA (press the D putton in mplayer I think). If I could just get one of those iegd drivers... Thanks Gwenole from splitted-desktop.com for answering my email and of course for writing the mplayer-vaapi patches in the first place! He seems to be the absolute VAAPI expert.
Also some experiments show that I can attach an external screen and watch videos with VAAPI on it. That means I should be able to actually use the netbook for decoding HD video and displaying it on an external screen. (But it does not work for me with except in mirror or single display mode.) Only thing missing now is a digital display port to connect a FullHD display... ;)
You might also be interested in Surround Sound and Battery Life
And I did get a USB surround sound card working wonderfully now. Also here's some advice I wrote on decreasing your power consumption.
Update: It turns out deinterlacing not working is not due to VAAPI, but a limit in the psb driver. It works with the current iegd driver and other drivers from AMD and NVIDIA (press the D putton in mplayer I think). If I could just get one of those iegd drivers... Thanks Gwenole from splitted-desktop.com for answering my email and of course for writing the mplayer-vaapi patches in the first place! He seems to be the absolute VAAPI expert.
Also some experiments show that I can attach an external screen and watch videos with VAAPI on it. That means I should be able to actually use the netbook for decoding HD video and displaying it on an external screen. (But it does not work for me with except in mirror or single display mode.) Only thing missing now is a digital display port to connect a FullHD display... ;)
You might also be interested in Surround Sound and Battery Life
And I did get a USB surround sound card working wonderfully now. Also here's some advice I wrote on decreasing your power consumption.
Subscribe to:
Posts (Atom)

