0

i'm trying to overlap two video clips using FFMpeg. I'm using the following command:

ffmpeg -i a.mp4 -i b.mp4 -filter_complex "blend=all_mode='multiply'" c.mp4

I was expecting to get something like in a bitmap editor. Instead, I get a green overlay on top of the resulting video.

Could you explain that and help me fix my command-line? I'm also open to other alternative programs.

Thanks

Edit:

Here if the full log

ffmpeg version n4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'contrast.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
  Duration: 00:00:02.67, start: 0.000000, bitrate: 1071 kb/s
    Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 1920x1080, 985 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 86 kb/s (default)
    Metadata:
      handler_name    : Core Media Audio
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'contrast.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
  Duration: 00:00:02.67, start: 0.000000, bitrate: 1071 kb/s
    Stream #1:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 1920x1080, 985 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 86 kb/s (default)
    Metadata:
      handler_name    : Core Media Audio
File 'combined.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 (h264) -> blend:top (graph 0)
  Stream #1:0 (h264) -> blend:bottom (graph 0)
  blend (graph 0) -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x558fa4a84680] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x558fa4a84680] profile High 4:4:4 Predictive, level 4.0, 4:4:4, 8-bit
[libx264 @ 0x558fa4a84680] 264 - core 157 r2945 72db437 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'combined.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p, 1920x1080, q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default)
    Metadata:
      encoder         : Lavc58.54.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 69 kb/s (default)
    Metadata:
      handler_name    : Core Media Audio
      encoder         : Lavc58.54.100 aac
frame=   79 fps= 19 q=-1.0 Lsize=     329kB time=00:00:02.64 bitrate=1018.5kbits/s speed=0.639x    
video:297kB audio:28kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.255968%
[libx264 @ 0x558fa4a84680] frame I:2     Avg QP:11.42  size:  9143
[libx264 @ 0x558fa4a84680] frame P:27    Avg QP:20.64  size:  4721
[libx264 @ 0x558fa4a84680] frame B:50    Avg QP:22.19  size:  3150
[libx264 @ 0x558fa4a84680] consecutive B-frames: 12.7%  7.6%  3.8% 75.9%
[libx264 @ 0x558fa4a84680] mb I  I16..4: 97.7%  0.0%  2.3%
[libx264 @ 0x558fa4a84680] mb P  I16..4:  9.0%  0.0%  1.0%  P16..4:  4.9%  1.1%  0.3%  0.0%  0.0%    skip:83.7%
[libx264 @ 0x558fa4a84680] mb B  I16..4:  2.1%  0.0%  0.2%  B16..8:  9.6%  1.2%  0.0%  direct: 0.6%  skip:86.2%  L0:52.2% L1:46.4% BI: 1.4%
[libx264 @ 0x558fa4a84680] coded y,u,v intra: 4.5% 0.3% 1.0% inter: 0.9% 0.1% 0.5%
[libx264 @ 0x558fa4a84680] i16 v,h,dc,p: 68% 18%  9%  4%
[libx264 @ 0x558fa4a84680] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 32% 10% 28%  4%  7%  9%  4%  6%  1%
[libx264 @ 0x558fa4a84680] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x558fa4a84680] ref P L0: 52.8%  6.5% 24.4% 16.3%
[libx264 @ 0x558fa4a84680] ref B L0: 70.8% 23.2%  6.0%
[libx264 @ 0x558fa4a84680] ref B L1: 88.5% 11.5%
[libx264 @ 0x558fa4a84680] kb/s:920.37
[aac @ 0x558fa4b1ea00] Qavg: 1424.024
  • Share full log. Your videos are almost certainly in YUV. – Gyan Dec 6 '19 at 16:41
  • @Gyan Thanks, I edited my post with le log – Alex Dec 8 '19 at 17:26
0

I solved my problem thanks to @Gyan comment:

ffmpeg -i bg.mp4 -i fg.mov -filter_complex "[0:v] format=rgba [bg]; [1:v] format=rgba [fg]; [bg][fg] blend=all_mode='multiply':all_opacity=1, format=rgba"  out.mp4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.