Extract alpha channel from webm video

1

I'm trying to extract a mask from a webm video with alpha transparency:

ffmpeg -i test.webm -vf "alphaextract" -y output.mp4

But I'm getting an error:

[Parsed_alphaextract_2 @ 0x7f924b700d00] Requested planes not available.
[Parsed_alphaextract_2 @ 0x7f924b700d00] Failed to configure input pad on Parsed_alphaextract_2

Am I doing something wrong? The documentation for alphaextract is surprisingly sparse.

Here's the ffprobe readout:

ffprobe version 2.8.6 Copyright (c) 2007-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.6 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libvpx --enable-libopus --enable-vda
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, matroska,webm, from 'test.webm':
  Metadata:
    encoder         : Lavf56.40.101
  Duration: 00:00:05.00, start: 0.000000, bitrate: 407 kb/s
    Stream #0:0: Video: vp8, yuv420p, 480x244, SAR 1:1 DAR 120:61, 24 fps, 24 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      alpha_mode      : 1

Andy E

Posted 2016-02-23T13:55:18.130

Reputation: 1 033

Please paste the readout of ffprobe for the file. – Gyan – 2016-02-23T14:06:22.263

Done. Also it's worth mentioning that I created this webm from an mp4 and a mask, I'm now trying to work out how to do the reverse. – Andy E – 2016-02-23T14:08:49.117

I've made a few VP8 with alpha myself, and the alpha doesn't seem to be stored traditionally i.e. as an adjunct plane. Let me check. – Gyan – 2016-02-23T14:11:52.260

Seems not possible with ffmpeg. – Gyan – 2016-02-23T14:41:33.700

Damn, that is a shame. Thanks @Mulvya, please feel free to post an answer explaining that. – Andy E – 2016-02-23T14:44:35.057

Answers

2

At this time, none of ffmpeg's VP8 decoders seem able to decode alpha in VP8 video streams. This post from the ffmpeg-user mailing list suggests it's due to the unusual method by which alpha is stored within the stream.

Might be worth looking at webm-tools.

Gyan

Posted 2016-02-23T13:55:18.130

Reputation: 21 016

3

Since 2016-07-20, it's possible to decode properly a webm with alpha channel (VP8a or VP9a) but you need -vcodec libvpx option. You must download an FFmpeg compiled after that date (or compile yourself with up-to-date commits) and use the following command:

ffmpeg -vcodec libvpx -i test.webm -vf alphaextract -y output.mp4

Note that -vcodec libvpx is before the input, not after it.

cdlvcdlv

Posted 2016-02-23T13:55:18.130

Reputation: 703