[FFmpeg-user] Transparent video overlay
Arjun Kaneria
arjunk.w3nuts at gmail.com
Tue Jun 11 12:49:26 EEST 2024
Hi all,
I am trying to overlay a transparent output.webm video onto a png image.
But I am not getting the image in the background in output. The transparent
part in the video turns black. How do I get transparent overlaid output?
This is my command:
C:\ffmpeg-6.0-full_build\bin\ffmpeg.exe -y -threads 12 -loop 1 -i
C:\temp_6666c89391d992.45596089/out_color.png -i
C:\temp_6666c89391d992.45596089/output.webm -filter_complex
"[0]format=pix_fmts=yuva420p,setpts=PTS/1-STARTPTS+0/TB,scale=1920:1080,setsar=1:1,setdar=dar=16/9[s0];[1]format=pix_fmts=yuva420p,trim=start=0:end=10,setpts=PTS/1-STARTPTS+0/TB,scale=1920:1080,setsar=1:1,setdar=dar=16/9[s1];[s0][s1]overlay=shortest=1:x=0:y=0:enable='between(t,'0','10')'[out_1]"
-map [out_1] -vcodec libvpx-vp9 -crf 18 -acodec libmp3lame -b:a 128k -t 10
C:\temp_6666c89391d992.45596089/127adc7ac73bbaf4ffd35e8c1f0613f2ab4db590.webm
Full Output:
ffmpeg version 6.0-full_build-www.gyan.dev Copyright (c) 2000-2023 the
FFmpeg developers
built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static
--disable-w32threads --disable-autodetect --enable-fontconfig
--enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib
--enable-lzma --enable-libsnappy --enable-zlib --enable-librist
--enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth
--enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24
--enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi
--enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom
--enable-libjxl --enable-libopenjpeg --enable-libvpx
--enable-mediafoundation --enable-libass --enable-frei0r
--enable-libfreetype --enable-libfribidi --enable-liblensfun
--enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf
--enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec
--enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl
--enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl
--enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt
--enable-libopencore-amrwb --enable-libmp3lame --enable-libshine
--enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc
--enable-libilbc --enable-libgsm --enable-libopencore-amrnb
--enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa
--enable-libbs2b --enable-libflite --enable-libmysofa
--enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 58. 2.100 / 58. 2.100
libavcodec 60. 3.100 / 60. 3.100
libavformat 60. 3.100 / 60. 3.100
libavdevice 60. 1.100 / 60. 1.100
libavfilter 9. 3.100 / 9. 3.100
libswscale 7. 1.100 / 7. 1.100
libswresample 4. 10.100 / 4. 10.100
libpostproc 57. 1.100 / 57. 1.100
Input #0, png_pipe, from 'C:\temp_6666c89391d992.45596089/out_color.png':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: png, rgb24(pc), 508x285 [SAR 3780:3780 DAR 508:285],
25 fps, 25 tbr, 25 tbn
Input #1, matroska,webm, from 'C:\temp_6666c89391d992.45596089/output.webm':
Metadata:
COMPATIBLE_BRANDS: qt
MAJOR_BRAND : qt
MINOR_VERSION : 537199360
ENCODER : Lavf60.3.100
Duration: 00:00:10.01, start: 0.000000, bitrate: 229 kb/s
Stream #1:0(eng): Video: vp8, yuv420p(tv, progressive), 1920x1080, SAR
1:1 DAR 16:9, 29.97 fps, 29.97 tbr, 1k tbn (default)
Metadata:
alpha_mode : 1
HANDLER_NAME : Apple Video Media Handler
VENDOR_ID : appl
TIMECODE : 00:00:00;00
ENCODER : Lavc60.3.100 libvpx
DURATION : 00:00:10.010000000
[out#0/webm @ 000001c5490fd180] Codec AVOption b (set bitrate (in bits/s))
has not been used for any stream. The most likely reason is either wrong
type (e.g. a video option with no video streams) or that it is a private
option of some encoder which was not actually used for any stream.
Stream mapping:
Stream #0:0 (png) -> format:default
Stream #1:0 (vp8) -> format:default
overlay:default -> Stream #0:0 (libvpx-vp9)
Press [q] to stop, [?] for help
[libvpx-vp9 @ 000001c5490ff380] v1.13.0-71-g45dc0d34d
Output #0, webm, to
'C:\temp_6666c89391d992.45596089/127adc7ac73bbaf4ffd35e8c1f0613f2ab4db590.webm':
Metadata:
encoder : Lavf60.3.100
Stream #0:0: Video: vp9, yuva420p(tv, progressive), 1920x1080 [SAR 1:1
DAR 16:9], q=2-31, 25 fps, 1k tbn
Metadata:
encoder : Lavc60.3.100 libvpx-vp9
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 250 fps= 15 q=18.0 Lsize= 84kB time=00:00:09.96 bitrate=
68.9kbits/s speed=0.593x
video:68kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 23.366596%
Thank you,
More information about the ffmpeg-user
mailing list