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

<pre><code>ffmpeg -i logo.webm -vcodec libvpx -i cortina.webm -filter_complex overlay -vcodec libvpx output.webm
</code></pre>

<p>Note that <code>-vcodec libvpx</code> is <strong>before</strong> the input that needs to be read using the alpha planes (in this case, is <code>cortina.webm</code> the overlaid video, thus we put the option just before it).</p>

<p>(As Mulvya states, the format conversion should be avoided in this case.)</p>

CC BY-SA 3.0
2016-08-24T15:44:25.650Z
Why `format=rgb`? Unnecessary and lossy given that the inputs are YUV and vpx encodes to YUV.
Gyan
CC BY-SA 3.0
2016-08-24T15:54:18.427Z
You're right. I didn't notice it (just copied his command and added the option). I correct it.
cdlvcdlv
CC BY-SA 3.0
2016-08-24T15:29:57.273Z
2016-08-24T16:00:59.340Z
2016-08-24T16:00:59.340Z
cdlvcdlv
<p>I'm trying to merge two transparent webm videos together while keeping their transparency using ffmpeg.</p>

<p>Main video: 
<a href="https://s3.amazonaws.com/medlike/logo.webm" rel="nofollow">https://s3.amazonaws.com/medlike/logo.webm</a></p>

<p>Overlay video:
<a href="https://s3.amazonaws.com/medlike/cortina.webm" rel="nofollow">https://s3.amazonaws.com/medlike/cortina.webm</a></p>

<p>Reading trough ffmpeg wiki and some stackexchange answers I made this: </p>

<pre><code>ffmpeg -i logo.webm -i cortina.webm -filter_complex 'overlay=format=rgb' -vcodec libvpx output.webm
</code></pre>

<p>The result:
<a href="https://s3.amazonaws.com/medlike/output.webm" rel="nofollow">https://s3.amazonaws.com/medlike/output.webm</a></p>

<p>The desired output should look like this: <a href="https://s3.amazonaws.com/medlike/vinheta-completa.webm" rel="nofollow">https://s3.amazonaws.com/medlike/vinheta-completa.webm</a></p>

<p>ffmpeg output:</p>

<pre><code>ffmpeg version 2.5.2 Copyright (c) 2000-2014 the FFmpeg developers
  built on Feb 15 2015 22:16:36 with Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.5.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libvorbis --enable-libvpx --enable-libass --enable-ffplay --enable-libfdk-aac --enable-libopus --enable-libquvi --enable-libx265 --enable-nonfree --enable-vda
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 13.100 / 56. 13.100
  libavformat    56. 15.102 / 56. 15.102
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, matroska,webm, from 'logo.webm':
  Metadata:
    encoder         : Lavf56.19.101
  Duration: 00:00:09.80, start: 0.000000, bitrate: 712 kb/s
    Stream #0:0: Video: vp8, yuv420p, 960x540, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      alpha_mode      : 1
Input #1, matroska,webm, from 'cortina.webm':
  Metadata:
    encoder         : Lavf56.19.101
  Duration: 00:00:09.80, start: 0.000000, bitrate: 436 kb/s
    Stream #1:0: Video: vp8, yuv420p, 960x540, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      alpha_mode      : 1
[swscaler @ 0x7f9512006800] No accelerated colorspace conversion found from yuv420p to argb.
[libvpx @ 0x7f9511827000] v1.3.0
Output #0, webm, to 'output.webm':
  Metadata:
    encoder         : Lavf56.15.102
    Stream #0:0: Video: vp8 (libvpx), yuv420p, 960x540 [SAR 1:1 DAR 16:9], q=-1--1, 200 kb/s, 25 fps, 1k tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc56.13.100 libvpx
Stream mapping:
  Stream #0:0 (vp8) -&gt; overlay:main
  Stream #1:0 (vp8) -&gt; overlay:overlay
  overlay -&gt; Stream #0:0 (libvpx)
Press [q] to stop, [?] for help
frame=  245 fps=6.3 q=0.0 Lsize=     114kB time=00:00:09.80 bitrate=  95.6kbits/s    
video:112kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.853043%
</code></pre>

<p>Thanks</p>

CC BY-SA 3.0
2015-02-25T04:37:42.107Z
*Stream #1:0: Video: vp8, yuv420p* *Stream #0:0: Video: vp8, yuv420p* Looks like your video doesn't have an alpha channel, if it did it would be *yuva420p*. See this post for more: http://bit.ly/1Es6KLK
stib
CC BY-SA 3.0
2015-02-25T04:59:30.857Z
That's what I thought, too.  `metadata: alpha_mode: 1` is from `libavformat/matroskadec.c`.  It means the alpha flag was set in the input webm.  `ffmpeg -h decoder=vp8` shows the vp8 decoder doesn't take any options, though.  So if it's not decoding to `yuva420p`, IDK how to change that.
Peter Cordes
CC BY-SA 3.0
2015-02-25T05:02:08.277Z
Also, why are you telling `overlay` to output RGB?  I don't see anything in the docs about alpha-blending problems when operating in YUV space.
Peter Cordes
CC BY-SA 3.0
2015-02-26T14:16:14.333Z
I wasn't able to solve the issue, instead, I rendered both videos using PNG codec and successfully merged them using the overlay ffmpeg filter, and than converted it to webm
DaviBenNun
CC BY-SA 3.0
2015-11-12T22:04:48.340Z
Anyone make any progress? I have a non-transparent video and want to just force the video to not have transparency?
Meekohi
<ffmpeg>
Merge two transparent webm videos with FFmpeg
DaviBenNun
# Merge two transparent webm videos with FFmpeg

(Asked by: username_0 on 2015-02-24)

I'm trying to merge two transparent webm videos together while keeping their transparency using ffmpeg.
Main video: 
https://s3.amazonaws.com/medlike/logo.webm
Overlay video:
https://s3.amazonaws.com/medlike/cortina.webm
Reading trough ffmpeg wiki and some stackexchange answers I made this: 
ffmpeg -i logo.webm -i cortina.webm -filter_complex 'overlay=format=rgb' -vcodec libvpx output.webm

The result:
https://s3.amazonaws.com/medlike/output.webm
The desired output should look like this: https://s3.amazonaws.com/medlike/vinheta-completa.webm
ffmpeg output:
ffmpeg version 2.5.2 Copyright (c) 2000-2014 the FFmpeg developers
  built on Feb 15 2015 22:16:36 with Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.5.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libvorbis --enable-libvpx --enable-libass --enable-ffplay --enable-libfdk-aac --enable-libopus --enable-libquvi --enable-libx265 --enable-nonfree --enable-vda
  libavutil      54. 15.100 / 54. 15.100
  libavcodec     56. 13.100 / 56. 13.100
  libavformat    56. 15.102 / 56. 15.102
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  2.103 /  5.  2.103
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, matroska,webm, from 'logo.webm':
  Metadata:
    encoder         : Lavf56.19.101
  Duration: 00:00:09.80, start: 0.000000, bitrate: 712 kb/s
    Stream #0:0: Video: vp8, yuv420p, 960x540, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      alpha_mode      : 1
Input #1, matroska,webm, from 'cortina.webm':
  Metadata:
    encoder         : Lavf56.19.101
  Duration: 00:00:09.80, start: 0.000000, bitrate: 436 kb/s
    Stream #1:0: Video: vp8, yuv420p, 960x540, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      alpha_mode      : 1
[swscaler @ 0x7f9512006800] No accelerated colorspace conversion found from yuv420p to argb.
[libvpx @ 0x7f9511827000] v1.3.0
Output #0, webm, to 'output.webm':
  Metadata:
    encoder         : Lavf56.15.102
    Stream #0:0: Video: vp8 (libvpx), yuv420p, 960x540 [SAR 1:1 DAR 16:9], q=-1--1, 200 kb/s, 25 fps, 1k tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc56.13.100 libvpx
Stream mapping:
  Stream #0:0 (vp8) -> overlay:main
  Stream #1:0 (vp8) -> overlay:overlay
  overlay -> Stream #0:0 (libvpx)
Press [q] to stop, [?] for help
frame=  245 fps=6.3 q=0.0 Lsize=     114kB time=00:00:09.80 bitrate=  95.6kbits/s    
video:112kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.853043%

Thanks

**Tags:** ffmpeg

> **Comments:**
> **username_1**: *Stream #1:0: Video: vp8, yuv420p* *Stream #0:0: Video: vp8, yuv420p* Looks like your video doesn't have an alpha channel, if it did it would be *yuva420p*. See this post for more: http://bit.ly/1Es6KLK  
> **username_2**: That's what I thought, too.  `metadata: alpha_mode: 1` is from `libavformat/matroskadec.c`.  It means the alpha flag was set in the input webm.  `ffmpeg -h decoder=vp8` shows the vp8 decoder doesn't take any options, though.  So if it's not decoding to `yuva420p`, IDK how to change that.  
> **username_2**: Also, why are you telling `overlay` to output RGB?  I don't see anything in the docs about alpha-blending problems when operating in YUV space.  
> **username_0**: I wasn't able to solve the issue, instead, I rendered both videos using PNG codec and successfully merged them using the overlay ffmpeg filter, and than converted it to webm  
> **username_3**: Anyone make any progress? I have a non-transparent video and want to just force the video to not have transparency?  

---

## 1 answers

### Answer by username_4 on 2016-08-24. Score: 4

Since 2016-07-20, it's possible to decode properly a webm with alpha channel (VP8a or VP9a) but you need the -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 -i logo.webm -vcodec libvpx -i cortina.webm -filter_complex overlay -vcodec libvpx output.webm

Note that -vcodec libvpx is before the input that needs to be read using the alpha planes (in this case, is cortina.webm the overlaid video, thus we put the option just before it).
(As Mulvya states, the format conversion should be avoided in this case.)

> **Comments:**
> **username_5**: Why `format=rgb`? Unnecessary and lossy given that the inputs are YUV and vpx encodes to YUV.  
> **username_4**: You're right. I didn't notice it (just copied his command and added the option). I correct it.  

---

