Tuesday, May 10, 2011

StageVideo in Adobe AIR 2.6


My carefully crafted title describes a thing that does not exist.
You can get it only on AIR for TV. And I bet your hardware specs do not contain such exotic devices!
And another bummer is that AIR 2.7 won't have it either.

So what can you do?

Well if the thing you're building has a mouse and asking the user to initiate Full Screen is acceptable you can try this.

If you can choose the hardware you have a really good chance with a combo of ARI 2.6, Windows, H.264 and one of the Nvidia cards that support H.264 hw accelerated decoding with Flash. 
On Mac you will need OSX 10.6.3+ with NVIDIA GeForce 9400M, GeForce 320M or GeForce GT 330M.

My tests on WinXP with a Quadro FX card were really promising. Running AIR in Full Screen while playing the Fast Five 1080p Trailer 2 file was smooth and took only 50% CPU. Same as Quicktime Player actually.
Testing on Mac was not that promising. On a MBP 13'' with a GeForce 320M CPU was around 100% and the playback was bad. I guess that for now my goal of using Mac Mini as the base hardware for a video kiosk won't happen.

So the conclusion for now is that you can get fast HD video playback in Adobe AIR on any screen across all desktop devices as long as the video is H.264, the device has a specific video card and it runs Windows.

Ford be praised!

Update 16.05.2011:
Some more thoughts about H.264 playback on OSX...
If your client is of the cool enterprise kind and loves Mac Minis then you really want to deliver.
So you do some more testing, coding with one hand and keeping your fingers crossed on the other.
I tried the new wonder kid on the block, the Titanium Desktop from Appcelerator. Simple thing to do, really. Just put a HTML5 video tag in the Resources/index.html file and point it to your local video file. But the performance was daunting. CPU was around 100% but playback was choppy as hell. Maybe it can't deal with dual cores properly...
Since I already had the html file I dragged it into Safari for old times sake.
Now that's the life... 70% CPU max. Smooth as silk. Like coming home. I almost fired up XCode and learned Objective C :-)
A final word on this. I tried the AIR 2.6 sample app on a Mac Mini with the NVidia 320M. CPU was around 140% but playback was smooth on all 3 tryouts. Also on my not so new MBP with it's GeForce 8600M GT playback was smooth after a fresh reboot with around 165% CPU. The same video at 720p had excellent playback and good image quality with max 110% CPU on my MBP.
So I'd say that this would also be an acceptable solution: use AIR on the Mac Mini, lower the encoding to 720p in case the playback is unsatisfactory and update your app to StageVideo + 1080p once StageVideo becomes available on Adobe AIR.

Update 10.11.2011:
Adobe AIR 3 is out and still no StageVideo for the desktop. But at least we're rid of Flash for mobile. That shows some progress :-D
However the AIR 3.2 Beta on Labs does have multi-threaded video decoding which "should improve the overall performance on all platforms". Hmmm...

The JavaScript Trap

Important notice for free software supporters using Gmail!
"Are you using Gmail? Nearly 50% of the FSF's 40,000 strong supporter mailing list has an @gmail.com email address.
Because of the incredibly high percentage of Gmail-using free software supporters, we're taking action to raise awareness about how to use Gmail without using proprietary software. We'll also be working on longer term solutions, but the most immediate positive step to take is to stop running the proprietary programs."
The Free Software Foundation 
Take action!

To be, or not to be, that is the question...