Super User Asked by Nisarg on November 29, 2021
I want to overlay one video on to another.I have two videos with same time duration.
Aim is to make upper video little transparent so that one can see whats happening in background video.
I’ve tried below command :
String command="ffmpeg -y -i /sdcard/videokit/two.mp4 -i /sdcard/videokit/inone.mp4 -filter_complex [0:v][1:v]overlay=100:100:eof_action=pass[v] -map [v] /sdcard/videokit/output.mp4";
In this command upper video isn’t matching(In context of height and width) with video at back.
Confusion : There may be a possibility that background video wont have same height width as upper video cause it comes dynamically in that case how should I manage..!!!
Any help or suggestions would be appreciated.
The command below resizes the upper video to match the base video and also gives it transparency.
ffmpeg -y -i /sdcard/videokit/two.mp4 -i /sdcard/videokit/inone.mp4 -filter_complex "[1:v][0:v]scale2ref[ua][b];[ua]setsar=1,format=yuva444p,colorchannelmixer=aa=0.5[u];[b][u]overlay=eof_action=pass[v]" -map [v] /sdcard/videokit/output.mp4
The scale2ref
resizes the second video to match the dimensions of the first. Then the colorchannelmixer
tweaks the alpha channel to give it 50% transparency.
Answered by Gyan on November 29, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP