How to get alpha channel from RGBA video ?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to get alpha channel from RGBA video ?

Mathieu Virbel
Hi folks,

I'm trying to get alpha working from a avi video, without success.
My video is a set of uncompressed PNG image, 32 bpp. Even if my
current code is in Python, the pipeline look like:

filesrc location=rgbavideo.avi ! decodebin ! ffmpegcolorspace !
video/x-raw-rgb,red_mask=(int)0xff000000,green_mask=(int)0x00ff0000,blue_mask=(int)0x0000ff00,alpha_mask=(int)0x000000ff,bpp=32,depth=32
! appsink

After getting the buffer from appsink, the alpha channel is still 0xff :
>>> print set(self._buffer.data[3::4])
set(['\xff'])

The caps detected by decodebin/avidemux is:
video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321,
red_mask=(int)65280, green_mask=(int)16711680,
blue_mask=(int)-16777216, framerate=(fraction)25/1, width=(int)1080,
height=(int)540

With ffmpeg, i'm able to convert the video into png, and the png got
the alpha background. FFMpeg show :
Input #0, avi, from 'Fleches_3.avi':
  Duration: 00:00:10.00, start: 0.000000, bitrate: 466965 kb/s
    Stream #0.0: Video: rawvideo, bgra, 1080x540, 25 tbr, 25 tbn, 25 tbc

I've tryied to use ffdemux_avi instead of decodebin, without success.

Is anyone have an idea about how to get the alpha channel from the
video source ?

Regards,

Mathieu
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to get alpha channel from RGBA video ?

Sudarshan Bisht
What if you do not use ffmpegcolorspace, because capsfilter seems to be correct but caps detected by decodebin/avidemux does not look appropriate since it's missing alpha_mask.

Its just a guess ! 





On Fri, Mar 18, 2011 at 11:14 PM, Mathieu Virbel <[hidden email]> wrote:
Hi folks,

I'm trying to get alpha working from a avi video, without success.
My video is a set of uncompressed PNG image, 32 bpp. Even if my
current code is in Python, the pipeline look like:

filesrc location=rgbavideo.avi ! decodebin ! ffmpegcolorspace !
video/x-raw-rgb,red_mask=(int)0xff000000,green_mask=(int)0x00ff0000,blue_mask=(int)0x0000ff00,alpha_mask=(int)0x000000ff,bpp=32,depth=32
! appsink

After getting the buffer from appsink, the alpha channel is still 0xff :
>>> print set(self._buffer.data[3::4])
set(['\xff'])

The caps detected by decodebin/avidemux is:
video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321,
red_mask=(int)65280, green_mask=(int)16711680,
blue_mask=(int)-16777216, framerate=(fraction)25/1, width=(int)1080,
height=(int)540

With ffmpeg, i'm able to convert the video into png, and the png got
the alpha background. FFMpeg show :
Input #0, avi, from 'Fleches_3.avi':
 Duration: 00:00:10.00, start: 0.000000, bitrate: 466965 kb/s
   Stream #0.0: Video: rawvideo, bgra, 1080x540, 25 tbr, 25 tbn, 25 tbc

I've tryied to use ffdemux_avi instead of decodebin, without success.

Is anyone have an idea about how to get the alpha channel from the
video source ?

Regards,

Mathieu
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



--
Regards,

Sudarshan Bisht

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to get alpha channel from RGBA video ?

Mathieu Virbel
Ok, yes, alpha is lost when conversion happen. I didn't removed
ffmpegcolorspace, but by removing caps, i'm able to get the alpha
channel.

But how can i do to have it working with caps ? I don't want to deal
with every possible caps available from video, that's why i've wanted
to use ffmpegcolorspace. Any tips ?

(By the way, what is the difference between bpp and depth ?)

2011/3/18 sudarshan bisht <[hidden email]>:

> What if you do not use ffmpegcolorspace, because capsfilter seems to be
> correct but caps detected by decodebin/avidemux does not look appropriate
> since it's missing alpha_mask.
> Its just a guess !
>
>
>
>
> On Fri, Mar 18, 2011 at 11:14 PM, Mathieu Virbel <[hidden email]> wrote:
>>
>> Hi folks,
>>
>> I'm trying to get alpha working from a avi video, without success.
>> My video is a set of uncompressed PNG image, 32 bpp. Even if my
>> current code is in Python, the pipeline look like:
>>
>> filesrc location=rgbavideo.avi ! decodebin ! ffmpegcolorspace !
>>
>> video/x-raw-rgb,red_mask=(int)0xff000000,green_mask=(int)0x00ff0000,blue_mask=(int)0x0000ff00,alpha_mask=(int)0x000000ff,bpp=32,depth=32
>> ! appsink
>>
>> After getting the buffer from appsink, the alpha channel is still 0xff :
>> >>> print set(self._buffer.data[3::4])
>> set(['\xff'])
>>
>> The caps detected by decodebin/avidemux is:
>> video/x-raw-rgb, bpp=(int)32, depth=(int)24, endianness=(int)4321,
>> red_mask=(int)65280, green_mask=(int)16711680,
>> blue_mask=(int)-16777216, framerate=(fraction)25/1, width=(int)1080,
>> height=(int)540
>>
>> With ffmpeg, i'm able to convert the video into png, and the png got
>> the alpha background. FFMpeg show :
>> Input #0, avi, from 'Fleches_3.avi':
>>  Duration: 00:00:10.00, start: 0.000000, bitrate: 466965 kb/s
>>    Stream #0.0: Video: rawvideo, bgra, 1080x540, 25 tbr, 25 tbn, 25 tbc
>>
>> I've tryied to use ffdemux_avi instead of decodebin, without success.
>>
>> Is anyone have an idea about how to get the alpha channel from the
>> video source ?
>>
>> Regards,
>>
>> Mathieu
>> _______________________________________________
>> gstreamer-devel mailing list
>> [hidden email]
>> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
>
> --
> Regards,
>
> Sudarshan Bisht
>
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to get alpha channel from RGBA video ?

pfarmer
Mathieu Virbel wrote
(By the way, what is the difference between bpp and depth ?)
bpp:    "The number of bits allocated per pixel. This is usually 16, 24 or 32."
depth: "The number of bits used per pixel by the R/G/B components. This is usually 15, 16 or 24."

[ http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-types-definitions.html ]

I posted this just because I was searching this on google and came to this post.