Having spent a little time researching options now, I thought I’d share my findings in case anyone else has to do some decision making in this area. Take what I’ve written with a grain of salt, as I’ve not exhaustively investigated all options, more tried to get a quick overview of things.
Options for decoding video frames on to an OpenGL texture in Windows in Cinder:
CinderWMF
- Pro: High-performance, hardware-accelerated
- Pro: Wide format support, given that it leverages the Windows Media Foundation
- Pro: Cinder native implementation exists
- Con: Appears to be unstable, possibly due to having to leverage DirectX to access video frames
Given how straight-forward it is to test if your code can work with this cinder-block, this should likely be your thing to try.
HPV
- Con: High-performance, although not hardware-accelerated
- Con: Video files must be in HPV format
- Con: No cinder native code exists
- Pro: A good starting point for code exists, in the OpenFrameworks code (similar to Cinder).
I’d wager this option, although requiring some elbow-grease in the form of coding, is most likely to cause the least on-going head-aches once complete. Not having to deal with multiple rendering contexts, or playing in DirectX can be worth some serious concessions.
ffmpeg-cpp
- Con: No cinder native code, but I believe this library to be a provide more access to the raw video data, i.e. it’s likely possible, although not straight-forward to leverage ffmpeg to get individual video frames on to an OpenGL texture.
- Con: Documentation for ffmpeg is allegedly almost non-existant.
- Pro: High-performance, sometimes hardware-accelerated
- Pro: Wide format support
If you absolutely must have wide-format support and hardware-acceleration and stability, then this might be your best option. My cursory research found a few sparse hints/examples of using the library to decode video into a texture, but nothing resembling a full-blown tutorial. Expect to spend a lot of time doing trial-and-error.
Honorary mentions:
LibVLC
https://www.videolan.org/vlc/libvlc.html
- Con: No cinder native code, and my cursory examination indicates that the library is more about giving you the option to integrate a built-in video player, rather than ‘easily’ manipulate/access individual frames on a texture.
- Pro: High-performance, sometimes hardware-accelerated
- Pro: Wide format support
I’m not sure this library allows easy access to individual video frames. Therefore I’ve put it under honorable mentions. I’m sure you can brute force your way in somehow, but likely at the cost of stability and head-aches.
HAP-Cinder
- Con: As far as I know, this doesn’t actually give you a frame in an OpenGL texture and is therefore technically not a viable option, unless you can figure out how to access the DirectShow output.
- Pro: Cinder native implementation exists
- Pro: High-performance, hardware-accelerated
- Con: Video files must be in HAP format
I think this library does give more ‘easy’ access to frames, but not in a native OpenGL context, thus it ends up an honorable mention.
This may be a silly question @lithium, but I’m assuming that your own work with the HPV framework isn’t available somewhere for public consumption…?
Cheers,
Gazoo