[SOLVED] Load a video with alpha channel OF 0.8.4

Hi !

I have some difficulties loading a video with alpha channel.
I rendered a movie with quicktime Animation codec (with blender) but I can’t get the alpha channel.
I also tried with a video I found on this forum that also have an alpha channel (I can’t upload it since I am a new user…)
I took the video from this post Using Video with Alpha, ofVideoPlayer, Linux gstreamer

Before loading the video, I call setPixelFormat(OF_PIXELS_RGBA) (I also tried OF_PIXELS_BGRA).
I always get an error :

[warning] ofQuickTimePlayer: setPixelFormat(): requested pixel format 2 not supported, expecting OF_PIXELS_RGB

I have been looking for other ways, but I found none except an old ofxAlphaVideoPlayer that doesn’t exists anymore.
So, here is my question: Nowadays, how can I load a video with an alpha channel ?
(BTW, I work on win7 / g++ / code::blocks / OF 0.8.4)

Thank you ! :smile:

I recommend using ofxHapPlayer: https://github.com/bangnoise/ofxHapPlayer
It’s GPU based, smooth and fast.
You need to install hap codec in your system:
https://github.com/Vidvox/hap-qt-codec/releases/tag/version-5

you can also try ofxGStreamer

Thanks a lot for these really fast answers.
I will give a try at your solutions asap.

Maybe I should explain my reason for doing this :
I would like to be able to render several layers of video in realtime. These videos will be in FHD (1920x1080). I would like to be able to render at least 10 of these each on top of the others. The order in which the layers are stacked is important. These videos will be playing at different speed and even backward. It will be controlled by the user.

I am quite sure I will be facing big problems soon trying to do so. I fear that my performances will be very very poor (If I can at least achieve it).

Should I forget this goal and move to something else ? Do you have any advice or clue for me ?
Thanks :smile:

Hi again Arturo

I am still downloading gstreamer (my internet connexion is really really slow) but I just noticed in another thread that ofxgstreamer doesn’t work under Code::Blocks…is it still true ?

yes that’s true, the addon will only work under visual studio

Ah crap !
Do you think it is possible to make it work with Code::Blocks (with a little bit of work), or I’d better go for another solution (or switch to Visual Studio) ?

the main problem with codeblocks was making the project generator create the project correctly but creating it manually by adding the search paths and libraries should be doable

ok
I’ll give a try. I’ll tell you if I succeeded or not

YATTA !!
It’s compiling fine. Just need to add the following libraries :
gstreamer-1.0
gstapp-1.0
gstbase-1.0
gstvideo-1.0
glib-2.0
gobject-2.0

The sample is running, but does nothing yet.

So, I succeeded compiling the sample program provided with ofxGStreamer.
But when running it, it complains about a libz-1.dll missing.
I found a libz.dll in mingW/bin and I renamed it. Unfortunatly, it doesn’t work at all…

I also downloaded the libz-1.dll found here (http://sourceforge.net/projects/mingw/files/MinGW/Extension/zlib/zlib-1.2.3-1-mingw32/) but the sample program still crash

Any idea ?

take a look at the addon_config.mk file in the ofxGStreamer folder it has all the search paths and libraries that you need to add, at least for visual studio but might be useful to add the correct settings in codeblocks

Thanks for the tip Arturo
Putting all the librairies I found in the addon_config.mk file helped me solve my problem. I can now use ofxGStreamer without crash the way it was meant to be used.

Still, it is not working…
I can read a normal RGB movie and draw it, but I can’t read a BGRA movie.
I setted OF_PIXEL_BGRA as needed (otherwise gstreamer complains), but the frames I get are completely empty…

Here is my application code :
main.cpp (341 Bytes)
ofApp.cpp (3.0 KB)
ofApp.h (600 Bytes)
I use the video file from the topic http://forum.openframeworks.cc/t/using-video-with-alpha-ofvideoplayer-linux-gstreamer/11307

I really don’t get it.

according to my test, ofxHapPlayer cannot load video(mov and wmv) on windows8.1, VS2012, OF0.8.0. i’ve already installed hap codec

@yangyangcv hap player draws only mov encoded with hap codec. It works fine for me with win8.

that video works for me without problem, have you tried RGBA?

Yes, I tried RGBA, but it gives me an error message at each frame

(OfxGstreamerTest_DEBUG.exe:3984): GStreamer-CRITICAL **: gst_segment_clip: assertion 'segment->format == format' failed

That is why I think this video is BGRA…but still, the frames I get are completely empty.
Did you try this video with the code I provided ? (which is your code btw :wink: )

I downloaded and instlled the version 1.4.4 of Gstreamer and now it works. It doesn’t matter if I set RGBA or BGRA, it always works !

So, for people who wants to use ofxGStreamer with OF 0.8.4 on Code::Blocks to read a video with an alpha channel, here are the steps :

If you try to compile the project, you will get undefined references. so you need to give additionnal librairies to code::Blocks

  • Open the addon_config.mk file in the ofxGStreamer folder and search the paths and libraries for Code::Blocks. Add them to your project if they are missing.

If the program complains about a libz-1.dll missing, then download it there.

Everything should work fine.
Thanks to all of you for your advice !

2 Likes

i just tried ofxGStreamer. it compiles successfully. but when it run, the error comes up saying “the procedure entry point g_cond_broadcast could not be located in the dynamic link library libgstapp-1.0-0.dll”. i’m using OF0.8.0 with gstreamer-1.0-x86-1.2.2.msi and gstreamer-1.0-devel-x86-1.2.2.msi installed on Windows8.1. the bin path is already added in the PATH variable.

I have succefully used alpha with ofxAVFFoundantion.


The downside is that it only accepts apple codecs for the moment, so to have an Alpha channel you need to use the apple pro res 4444 (which is a gigantic format)