Sign in to follow this  
fanaticlatic

looking for a library to load video with an alpha channel

Recommended Posts

fanaticlatic    473
Hi Folks,

The problem I have is that I want to be able to load in a video file (wholly or partially i.e. streaming) where the loaded frames contain an alpha channel. All the libraries (ffmpeg, ffdshow) that I can find do not seem to do this. I have found codecs that are capable of encoding the alpha information such as corePNG and MJpeg but then I would need to write an importer myself or I could use uncompressed AVI but then I would end up with HUGE filesizes.

Will I have to roll my own compression system to get the alpha channel when the video information is imported into my game or is there a library available for commercial use and preferably free already available????


thanks in advance,

Mark.

Share this post


Link to post
Share on other sites
fanaticlatic    473
[quote name='Shael' timestamp='1311115967' post='4837681']
You sure about FFmpeg/Libav? I'm looking at the supported pixel formats and it supports RGBA.
[/quote]

Do you have a link? I spent the better part of yesterday looking through FFmpeg and didn't notice anything that may support the RGBA format. 1 colour alpha won't do (green-screening) I need a full channel.


Thanks for the replies.

Mark.

Share this post


Link to post
Share on other sites
fanaticlatic    473
[quote name='Shael' timestamp='1311115967' post='4837681']
You sure about FFmpeg/Libav? I'm looking at the supported pixel formats and it supports RGBA.
[/quote]
[quote name='fanaticlatic' timestamp='1311150387' post='4837846']
Do you have a link? I spent the better part of yesterday looking through FFmpeg and didn't notice anything that may support the RGBA format. 1 colour alpha won't do (green-screening) I need a full channel.

Thanks for the replies.

Mark.
[/quote]



I called "ffmpeg -pix_fmt list" and it does indeed support argb, rgba, abgr, bgra formats for input and output. So the question then becomes does anyone know which codec ffmpeg uses to decode the video file when one of these formats is used as the input video pixel format?

I would also note that the four rgba versions are not hardware accelerated. Hardware acceleration would be very nice to have but not a deal breaker.


Thanks again.

Mark.

Share this post


Link to post
Share on other sites
Quicktime Animation format supports 32bit RGBA, its called Millions of Colors+ in the QuickTime interface. It is supported for decode and encode in the LibAVCodec library.

[quote name='fanaticlatic' timestamp='1311151209' post='4837849']
[quote name='Shael' timestamp='1311115967' post='4837681']
You sure about FFmpeg/Libav? I'm looking at the supported pixel formats and it supports RGBA.
[/quote]
[quote name='fanaticlatic' timestamp='1311150387' post='4837846']
Do you have a link? I spent the better part of yesterday looking through FFmpeg and didn't notice anything that may support the RGBA format. 1 colour alpha won't do (green-screening) I need a full channel.

Thanks for the replies.

Mark.
[/quote]



I called "ffmpeg -pix_fmt list" and it does indeed support argb, rgba, abgr, bgra formats for input and output. So the question then becomes does anyone know which codec ffmpeg uses to decode the video file when one of these formats is used as the input video pixel format?

I would also note that the four rgba versions are not hardware accelerated. Hardware acceleration would be very nice to have but not a deal breaker.


Thanks again.

Mark.
[/quote]

Share this post


Link to post
Share on other sites
fanaticlatic    473
[quote name='darrenmarklines' timestamp='1311168916' post='4837949']
Quicktime Animation format supports 32bit RGBA, its called Millions of Colors+ in the QuickTime interface. It is supported for decode and encode in the LibAVCodec library.
[/quote]

I spotted this quicktime format as well but from what I read the quicktime animation codec has been superseded by the corePNG codec. I will need to do some checks on file size and speed etc but I think either the animation or corePNG sound like the best formats moving forward.


Thanks all.

Mark.

Share this post


Link to post
Share on other sites
fanaticlatic    473
I don't know what possessed me to read through the MPEG-4 standard:

[url="http://mpeg.chiariglione.org/standards/mpeg-4/mpeg-4.htm"]http://mpeg.chiariglione.org/standards/mpeg-4/mpeg-4.htm[/url]
[url="http://books.google.co.uk/books?id=ftRvA08WcM4C&pg=PA318&lpg=PA318&dq=mpeg+4+transparency&source=bl&ots=lX4hzZOjNx&sig=PqOMz8QuAjN6xJhueg-A-COSr6U&hl=en&ei=l_UmTsfCDoyYOuK3wNIK&sa=X&oi=book_result&ct=result&resnum=1&ved=0CBcQ6AEwAA#v=onepage&q&f=false"]http://books.google.co.uk/books?id=ftRvA08WcM4C&pg=PA318&lpg=PA318&dq=mpeg+4+transparency&source=bl&ots=lX4hzZOjNx&sig=PqOMz8QuAjN6xJhueg-A-COSr6U&hl=en&ei=l_UmTsfCDoyYOuK3wNIK&sa=X&oi=book_result&ct=result&resnum=1&ved=0CBcQ6AEwAA#v=onepage&q&f=false[/url]



but I did and it would seem it's exactly what I was after :) can anyone think why there aren't more examples of mpeg-4 being used as a video codec with alpha channels?

Are there licensing issues/costs?

Is it because it's a relatively new format, so adoption is fairly low right now?

Thanks in advance,

Mark.

Share this post


Link to post
Share on other sites
fanaticlatic    473
[quote name='fanaticlatic' timestamp='1311178090' post='4838011']
I don't know what possessed me to read through the MPEG-4 standard:

[url="http://mpeg.chiariglione.org/standards/mpeg-4/mpeg-4.htm"]http://mpeg.chiarigl...eg-4/mpeg-4.htm[/url]
[url="http://books.google.co.uk/books?id=ftRvA08WcM4C&pg=PA318&lpg=PA318&dq=mpeg+4+transparency&source=bl&ots=lX4hzZOjNx&sig=PqOMz8QuAjN6xJhueg-A-COSr6U&hl=en&ei=l_UmTsfCDoyYOuK3wNIK&sa=X&oi=book_result&ct=result&resnum=1&ved=0CBcQ6AEwAA#v=onepage&q&f=false"]http://books.google....epage&q&f=false[/url]



but I did and it would seem it's exactly what I was after :) can anyone think why there aren't more examples of mpeg-4 being used as a video codec with alpha channels?

Are there licensing issues/costs?

Is it because it's a relatively new format, so adoption is fairly low right now?

Thanks in advance,

Mark.
[/quote]

Seems I spoke too soon.

On further inspection it seems I misunderstood that MPEG is merely a framework like OGG or AVI, which you store the encoded data from whichever codec you choose for compression.

So it seems that I actually need the codec to encode the data to retain the alpha. I can only find CorePNG that does this and its output file size is about 8 times what I would like it to be. Ideally I need an LGPL based codec similar to xVid ( can't use xVid as it is GPL and I don't think it supports alpha).

If anyone knows of any public domain / LGPL work going on in this area that may be of use please let me know.


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this