From 679c32086d4363565c221b8be2b99c0023e77a35 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Wed, 28 Dec 2016 14:25:30 -0800 Subject: [PATCH] deps/libff: Fix VP8/VP9/webm alpha support FFmpeg by default decodes VP8/VP9 via its internal encoders, however those internal encoders do not support alpha. Encoded alpha is stored via meta/side data in the container, so the only way to decode it properly is via forcing FFmpeg to use libvpx for decoding. --- deps/libff/libff/ff-demuxer.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deps/libff/libff/ff-demuxer.c b/deps/libff/libff/ff-demuxer.c index 6d77d3525..f027ad49a 100644 --- a/deps/libff/libff/ff-demuxer.c +++ b/deps/libff/libff/ff-demuxer.c @@ -297,7 +297,13 @@ static bool find_decoder(struct ff_demuxer *demuxer, AVStream *stream) } if (codec == NULL) { - codec = avcodec_find_decoder(codec_context->codec_id); + if (codec_context->codec_id == AV_CODEC_ID_VP8) + codec = avcodec_find_decoder_by_name("libvpx"); + else if (codec_context->codec_id == AV_CODEC_ID_VP9) + codec = avcodec_find_decoder_by_name("libvpx-vp9"); + + if (!codec) + codec = avcodec_find_decoder(codec_context->codec_id); if (codec == NULL) { av_log(NULL, AV_LOG_WARNING, "no decoder found for" " codec with id %d",