We're trying to interate ffmpeg4 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.
ffmpeg -i image_seq%03d.png -qmin 0 -qmax 50 -crf 5 -b:v 1M output.webm
Sample webm videos with alpha can be found on this page: https://simpl.info/videoalpha/
However on playing back we do not get the alpha unless we override the codec to be libvpx. (same behaviour can be demostrated in CLI version of ffplay). We are wrapping avutil, avcodec, etc.
Question: What is the correct way to identify (in code) that a VP8 or VP9 stream has an alpha component ? (So we can load it and access it via AVFrame() for use as an RGBA texture.)
More specifically:
We get the FormatContext from the file using AVFormatContext and the stream AVStream from that FormatContext.
Then from the AVStream we get the 'codecpar' param.
From the AVCodecParameters we can examine the codec_id (167 is VP9) and other useful params like bits_per_coded_sample.
Interestingly these values seem correct for streams like H264 (codec_id=27) at 24 bits but are marked as 0 for the VP9 codec. Leading me to think this is not the correct place to find the proper value.