Using Video with Alpha, ofVideoPlayer, Linux gstreamer

I want to use a video-file with transparency. I work under Linux (Ubuntu 12.04) with of 007 and use ofVideoPlayer.
What I figured out already: ofSetPixelFormat() set to RGBA before loading the movie. Transparency works, but i get a color-shift - the visible parts of the video show up red. I also tried it in the Videoplayer-Example, but there is also the same problem. I converted my video, which was originally a mov to other formats, codecs and the Pixelformat of my Video is RGBA. (original was yuvj420p)
Unfortunatly the colorshift to red stays all the same. I examined each Pixel-Channel separatley with ofGetPixelRef() and it seems, the first channel is always on 255.
I tried other videos with alpha - every time the same color-shift to red.
When I run the video just with RGB pixel format (without alpha-channel) in openframeworks, the colors are as they should (but of course no transparency…)
Would be glad, someone has any suggestions… :slight_smile:
Best regards,

I’m dealing with a similar issue with windows 7, gstreamer and alpha video and found a kludge fix for now…

Alpha videos were coming in semi-transparent with color shifts…

Found that when loading form OF_PIXELS_RGBA there seems to be a color shift to the right… RGBA becomes ARGB. So naturally I wrote a little app to swap the channels and save out a video that has pre-sorted them to be GBAR so that once the offset happens things are in place.

ugly but effective patch for now :slight_smile:

I am running into the same troubles now.
Ubuntu 12.04, of 0.8, Gstreamer, video with alpha channels

Any chance one of you has found a more elegant solution besides resaving the videos with swapped channels?
If not, m4rk34 - would you be willing to share your channel-swapping code?

I tried digging a bit deeper into the OF code to see if i could create a OF_PIXELS_ARGB pixelformat, but haven’t gotten anywhere yet.

in 0.8 with gstreamer you should be able to do:


and it’ll set rgba as the format for the video and a BGRA texture which should swap the channels in the graphics card

u mean


this works for you?
for me it just swaps the color channels, and not the alpha channel.

it would be necessary to revert all 4 channels, from ARGB to BGRA.
there seems to be such a GL image type out there: GL_UNSIGNED_INT_8_8_8_8_REV, but i am not quite sure where to plug that into the code.

ah, ok, thought it was BGRA. can you post a sample video with that format? or the program + settings you’ve used to encode it?

Sure, here is a sample video file (quicktime, animation codec) (720.3 KB)

Here is what the videofile looks like for me, with the videoPlayerExample

  1. no pixelformat defined

i’m trying it in ubuntu 13.10 which already has gstreamer 1.0 instead of 0.10 and it works without problem with both RGBA or BGRA so the problem is not in the texture but in the video player, in ofGstVideoPlayer, line 67

		mime = "video/x-raw-gray";
		bpp = 8;
		mime = "video/x-raw-rgb";
		bpp = 24;
		mime = "video/x-raw-rgb";
		bpp = 32;
		mime = "video/x-raw-rgb";

	GstCaps *caps = gst_caps_new_simple(mime.c_str(),
										"bpp", G_TYPE_INT, bpp,
										"depth", G_TYPE_INT, 24,

is the code that sets the format for 0.10, i think playing with the red, green, blue and alpha mask values should fix it

I already tried messing with these mask parameters. But as soon as i change something (like switch the red_mask and green_mask values) i get this output error:

xample/bin$ ./videoPlayerExample
[ error ] ofGstUtils: startPipeline(): unable to get pipeline paused state
[warning] ofGstUtils: getDurationNanos(): couldn’t query time duration

** (videoPlayerExample:29324): WARNING **: gstvideo: failed to get caps of pad app_sink:sink
[ error ] ofGstVideoPlayer: allocate(): couldn’t query width and height
[warning] ofGstVideoUtils: update(): ofGstVideoUtils not loaded
[warning] ofGstUtils: getDurationNanos(): couldn’t query time duration
[warning] ofGstUtils: getDurationNanos(): couldn’t query time duration
[warning] ofGstVideoUtils: update(): ofGstVideoUtils not loaded
[warning] ofGstUtils: getDurationNanos(): couldn’t query time duration
[warning] ofGstUtils: getDurationNanos(): couldn’t query time duration

can you try setting line 90 to:

"depth", G_TYPE_INT, 32,

that should allow you to change the masks to the correct order

awesome! it’s working now! THANK YOU!

and i didn’t need to swap them, all i needed to do was set the depth to 32, and add ‘00’ to the end of the mask values to make them 32-bit. (Leaving them as 24-bit values still produced the same errors).


GstCaps *caps = gst_caps_new_simple(mime.c_str(),
									"bpp", G_TYPE_INT, bpp,
									"depth", G_TYPE_INT, 32,

perfect, will fix it in next release