What's the fastest way to access video pixels in as3?

I would like to copy pixels from a 1080p video from one location to another efficiently / with minimal CPU impact.

So far, my implementation is pretty simple:

  • using Drawmap BitmapData method to capture pixels from video
  • using BitmapData copyPixels () to shuffle the pixels around

Ideally this would have as little CPU impact as possible, but I'm running out of options and can indeed use some advice from experienced actionscript 3 developers.

I profiled my code with Scout and noticed that the CPU usage is mostly around 70% but over 100%. I've looked at StageVideo , but one of the main limitations is this:

Video data cannot be copied to a BitmapData object (BitmapData.draw).

Is there a more direct way to access video pixels rather than rasterizing the DisplayObject?

Can I directly access each video frame as a ByteArray and connect it to the strong> BitmapData object? (I found appendBytes , but it seems to do whatever it needs to in my setup).

What's the most CPU friendly way to manipulate pixels from h264 1080p video in actionscript 3?

Also, is there a faster way to move pixels around others than copyPixels () using Flash Player?Also, I can see that Scout indicates that the video is not hardware accelerated ( .rend.video.hwrender: false

). Shouldn't h264 hardware acceleration (even without scene video) as per this article (or is it just for fullscreen)?


source to share

1 answer

The latest AIR beta introduced video as texture support that you could use to manipulate video on a GPU (and do it faster than with BitmapData). But keep in mind that it is currently only available for AIR on Windows and there are other restrictions.



All Articles