I have 3 files. The background
, an image with random shapes (which I call widgets
) and the main video
. The code below put the main video over this background, then the widgets over it. It’s working as expected but as you can see in the test_output.mp4
file on the given repository, some frames at beginning are ignoring the main video.
Repository with these files and command
https://github.com/marcobraghim/ffmpeg_tests/tree/main/start_bgoverlay
The code:
ffmpeg -y
-i "purple_bg.png"
-i "IMG_0026.png"
-ss 0:00:09.590000
-t 0:00:09.911000
-i "daniel_duncan.mp4"
-filter_complex "
[0:v]scale=720.0:-2[bg];
[1:v]scale=720.0:-2[widgets];
[2:v]scale=720.0:-2[mainMedia];
[bg][mainMedia]overlay=x=(W-w)/2:y=(H-h)/2[mix1];
[mix1][widgets]overlay[outfile]"
-r 30
-b:a 160k
-c:a aac
-c:v libx264
-s 720x1280
-crf 21
-preset medium
-map [outfile]
-map 2:a?
test_output.mp4