[Libav-user] What is correct method to identify streams containing alpha?
Anton Shekhovtsov
shekh.anton at gmail.com
Fri Jun 15 10:25:41 EEST 2018
Hi, "libvpx" is not input format, see this for example
AVCodec* pDecoder =
avcodec_find_decoder(m_pStreamCtx->codecpar->codec_id);
if(m_pStreamCtx->codecpar->codec_id==AV_CODEC_ID_VP8){
// on2 vp8 does not extract alpha
AVCodec* pDecoder2 = avcodec_find_decoder_by_name("libvpx");
if(pDecoder2) pDecoder = pDecoder2;
}
2018-06-15 3:02 GMT+03:00 Mark Schafer <mschafer at wireframe.biz>:
> Ahh I think its
>
> AVInputFormat *inputFormat =av_find_input_format("libvpx");avformat_open_input(&pAVFormatContext, dev_name, inputFormat, NULL)
>
>
> On 6/15/2018 11:49 AM, Mark Schafer wrote:
>
> OK. Thanks Carl.
>
> So you're saying I should always override it with libvpx if the file I'm
> loading is .webm ?
> and if you don't mind - how do I override the codec on load ?
> Is it in AVInputFormat by stipulating the extension and codec_tag ?
>
>
> On 6/15/2018 11:13 AM, Carl Eugen Hoyos wrote:
>
> 2018-06-14 23:03 GMT+02:00, Mark Schafer <mschafer at wireframe.biz>
> <mschafer at wireframe.biz>:
>
> We're trying to integrate ffmpeg 4 with Pyglet.
> Its all going very well but we have one issue:
>
> - If a VP9 (or VP8) file is created using ffmpeg4 from png files with
> alphas, we get a video file (webm) with alpha internally. (Excellent)
> - ffmpeg -i image_seq%03d.png -qmin 0 -qmax 50 -crf 5 -b:v 1M output.webm
> - The report from this CLI indicates that an alpha has been
> generated.
>
> - Sample webm videos with alpha can be found on this page:
> https://simpl.info/videoalpha/
> - However on playing back we only get the RGB and do not get the alpha
> unless we override the codec to be 'libvpx'.
>
> Yes, this is a known limitation of the native decoder, luckily you
> have already found the only known work-around - not to use it if
> you need this feature.
>
> If you really want to choose the decoder based on the alpha
> layer, you can check AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL
> if the side_data starts with (uint64_t) 1 there is a transparency layer.
>
> It is probably simpler to always use the libvpx decoder.
>
> Carl Eugen
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20180615/b170ac9a/attachment.html>
More information about the Libav-user
mailing list