2

I am trying to overlay background video with another semi transparent video using ffmpeg.

Thanks to Overlaying multiple videos with ffmpeg I managed to put video overlay over background video.

The problem is that I don't know how to make overlay video semitransparent.

So far I am using following commands:

ffmpeg -i VID_105470127_044810.mp4 -vf "movie=VID_21550603_142437.mp4 [a]; [in][a] overlay=10:10 [c]" combined.mp4

ffmpeg -i VID_105470127_044810.mp4  -i VID_21550603_142437.mp4 -filter_complex "overlay, overlay=10:10" combined.mp4

I tried to play with fade effect but this is not what I want. Please point me out where to look and what can I try to achieve this.

UPDATE #1

It looks like blend filter is exactly what I need but another issue came out:

ffmpeg -i video1280x720.mp4 -vf "movie=video640x640.mp4 [a]; [in][a] overlay=10:10 [c]" combined.mp4

[Parsed_blend_3 @ 0x7f8041500da0] First input link top parameters (size 1280x720, SAR 1:1) do not match the corresponding second input link bottom parameters (640x640, SAR 1:1)
[Parsed_blend_3 @ 0x7f8041500da0] Failed to configure output pad on Parsed_blend_3

So probably if I can resolve issue with different resolutions I am done with my task. Please advice what is the direction to go.

UPDATE#2

To solve different resolution problem I decided to crop video and then proceed with blending filter

ffmpeg -i VID_1920x1080.mp4 -filter:v "crop=640:640:0:0" -c:a copy VID_1920x1080_cropped.mp4

ffmpeg -i VID_1920x1080_cropped.mp4 -i VID_21550603_142437.mp4 \
-filter_complex "[1:0] setdar=dar=1,format=rgba [a]; [0:0]setdar=dar=1,format=rgba [b]; [b][a]blend=all_mode='overlay':all_opacity=0.8" blended.mp4
Community
  • 1
  • 1
endryha
  • 7,166
  • 8
  • 40
  • 64

2 Answers2

2

As solution I managed to crop file:

ffmpeg -i VID_1920x1080.mp4 -filter:v "crop=640:640:0:0" -c:a copy VID_1920x1080_cropped.mp4

...and then blend with another video:

ffmpeg -i VID_1920x1080_cropped.mp4 -i VID_21550603_142437.mp4 -filter_complex \
"[1:0]setdar=dar=1,format=rgba[a]; \
 [0:0]setdar=dar=1,format=rgba[b]; \
 [b][a]blend=all_mode='overlay':all_opacity=0.8" \
blended.mp4
llogan
  • 121,796
  • 28
  • 232
  • 243
endryha
  • 7,166
  • 8
  • 40
  • 64
-2

Below library supports support combine two videos by overlay one on other while they are playing without ffmpeg.

https://github.com/LanSoSdk/LanSoEditor_advance

I have checked this library, this library is developed base on GPUImage(opengl es).

Current library is not free version.

Jin Kai
  • 11
  • 1