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
metadata: alpha_mode: 1
is fromlibavformat/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 toyuva420p
, IDK how to change that.overlay
to output RGB? I don't see anything in the docs about alpha-blending problems when operating in YUV space.