Eu tenho uma sequência de quadros que concordo para criar um vídeo.
Em uma série de quadros, quero sobrepor uma imagem com opacidade variável (quero dar um efeito de desvanecimento no efeito de animação).
A opacidade deve variar w.r.t. tempo ou número do quadro ().
Tentei usar este comando:
ffmpeg -f concat -i input.txt -i inputImg.jpg -filter_complex "[1]format=argb,geq=r='r(X,Y)':a='T*alpha(X,Y)'[v1];[0][v1]overlay=x=70:y=100" -crf 22 -threads 2 -preset ultrafast output.mp4
Saída:
ffmpeg version N-81989-g7845c13 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
libavutil 55. 32.100 / 55. 32.100
libavcodec 57. 61.103 / 57. 61.103
libavformat 57. 52.100 / 57. 52.100
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 64.100 / 6. 64.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 2.100 / 2. 2.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, concat, from 'input.txt':
Duration: 00:00:22.01, start: 0.000000, bitrate: 0 kb/s
Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
Input #1, image2, from 'inputImg.jpg':
Duration: 00:00:00.04, start: 0.000000, bitrate: 545 kb/s
Stream #1:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 396x323 [SAR 1:1 DAR 396:323], 25 tbr, 25 tbn, 25 tbc
File 'output.mp4' already exists. Overwrite ? [y/N] y
[swscaler @ 0000000000c0c820] deprecated pixel format used, make sure you did set range correctly
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0000000000c04f40] using SAR=1/1
[libx264 @ 0000000000c04f40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0000000000c04f40] profile Constrained Baseline, level 4.0
[libx264 @ 0000000000c04f40] 264 - core 148 r2721 72d53ab - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=2 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=22.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
Output #0, mp4, to 'output.mp4':
Metadata:
encoder : Lavf57.52.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuvj420p(pc), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
Metadata:
encoder : Lavc57.61.103 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
Stream #0:0 (mjpeg) -> overlay:main
Stream #1:0 (mjpeg) -> format
overlay -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
frame= 599 fps=244 q=-1.0 Lsize= 251kB time=00:00:23.92 bitrate= 86.0kbits/s dup=587 drop=0 speed=9.76x
video:248kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.275079%
[libx264 @ 0000000000c04f40] frame I:3 Avg QP:12.33 size: 38456
[libx264 @ 0000000000c04f40] frame P:596 Avg QP:11.07 size: 232
[libx264 @ 0000000000c04f40] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 0000000000c04f40] mb P I16..4: 0.1% 0.0% 0.0% P16..4: 0.6% 0.0% 0.0% 0.0% 0.0% skip:99.4%
[libx264 @ 0000000000c04f40] coded y,uvDC,uvAC intra: 3.5% 7.1% 6.6% inter: 0.1% 0.3% 0.0%
[libx264 @ 0000000000c04f40] i16 v,h,dc,p: 95% 4% 1% 0%
[libx264 @ 0000000000c04f40] i8c dc,h,v,p: 81% 10% 8% 0%
[libx264 @ 0000000000c04f40] kb/s:84.59
Mas o vídeo de saída não contém a imagem sobreposta.
Observação: o tamanho do quadro e a imagem sobreposta têm dimensões diferentes.