Tuesday, March 24, 2009

The benefits of video card (GPU) acceleration

I finally got around to installing a Sapphire HD 2600XT video card I had purchased over year ago in my HTPC! I delayed because the case I have is rather cramped and this card occupies nearly two slots and plus, I didn't want to break a working system.

Well I should have done it sooner. Once it was shoehorned in and installed I noticed I was now able to play HD content recorded OTA smoothly whereas before it was unplayable. The software I am using (GB-PVR www.gbpvr.com and PowerDVD8) both can take advantage of the GPU on this card and pass off signficant amounts of rendering work via DXVA to the card. So what was taking 100% CPU before and still not being able to play content smoothly, is now only loading up the CPU about 20% with completely smooth playback.

There were a few hurdles on the way. Firstly I had to update to the latest drivers for the card from Sapphire. Since this is a AGP card and the ATI 2600 chipset is PCI, Sapphire have written custome drivers to enable the card to work. Luckily they seem to be keeping up with ATI drivers with their latest drivers dated March 2009.

Secondly my HTPC is connected to my HDTV via HDMI. But the card also has an analogue VGA out which I also connect to my HDTV (so select the appropriate input on the TV to see analogue or digital). The problem I hadn't realised was, in this dual monitor configuration PowerDVD8 crashes on startup and GB-PVR goes into a CPU loop! So I had to disable the analogue monitor which I don't use anyway.

Finally there are still some driver problems. Playing HD content 720p 0r 1080i with hardware acceleration works fine. But when trying to play SD content such as OTA 576p material with hardware acceleration enabled causes both PowerDVD8 and GB-PVR to display garbled video with flashes of recognisable images. I have to disable HW acceleration to view 576p content which works fine with the CPU running at abtou 60%. The problem is, while I can disable HW acceleration in PowerDVD8 I don't appear to be able to do so in GB-PVR - it's on all the time. This means I cannot play SD content in GB-PVR which makes the setup less user friendly.

Still it's a major leap over what I had before which basically was no viewing capability at all.

Friday, January 02, 2009

Converting AAC-HE LATM files to play on a Popcorn

As noted in a previous post TVNZ has chosen to broadcast its HD shows with H.264 video which is fine but AAC-HE LATM audio. This relatively new codec is difficult to handle on the PC platform though of course the DVB-T STB's can handle it. Only few programs can handle this audio including PowerDVD8, Winamp and some freeware/opensource software like gbpvr and mediaportal.

In order to process these files to play on the Popcorn Hour (a great media player by the way) I have had to resort to the following tortuous process.

Install PowerDVD8 (trial seems to be fine) to get the right audio codec loaded.

Play around with the merit values on the DS filters so that the PDVD8 Demuxer has a merit value of Preferred+1 (I am using Radlight to do this).

Load the ts file captured by gbpvr into Virtualdub using an avisynth script which only has one statement in it directshowsource("video file.ts")

If you have the filters right, the PDVD8 demux DS filter will pass the video/audio to Virtualdub. From there you can look at the properties of the audio. On my machine for some reason the audio is always sampled at 24Khz so I use Virtualdub to do a conversion to 48Khz. Then just save the wav file.

Next process the wav file into a more reasonable format (I use besweet to convert to AC3).

Finally using tsmuxer I input the original ts file (tsmuxer will complain about unrecognised audio - this is the AAC audio) and drop it. Then add in the AC3 file created above and output a new ts file with AC3 audio.

This will play fine on the Popcorn and VLC. There is a bit of art involved in this since on occasion the audio/video will not be in sync but luckily it is a constant difference. I have seen differences between 100ms (surprisingly easy to notice when looking at mouths speaking) to up to 1000ms. Anyway some experimentation and you can adjust the delay settings in tsmuxer to cater for that.

A lot of work but it can be done. Now Syabas - roll on a new firmware upgrade for the Popcorn Hour to handle this audio format.