Open Miserness974 opened 5 years ago
Anyone ?
I did not find much information in the official documentation. Only from sourcecode: https://zulko.github.io/moviepy/_modules/moviepy/video/fx/mask_color.html#mask_color
import moviepy.editor as mp
clip = mp.VideoFileClip('/home/me/path/to/green-screen-video.mp4')
# Mountains background
background = mp.ImageClip('https://www.worldatlas.com/r/w728-h425-c728x425/upload/66/14/d8/kangchenjunga.jpg')
masked_clip = clip.fx(mp.vfx.mask_color, color=[0, 255, 8], thr=100, s=5)
# You can remove this resize, it's just for test...
masked_clip = masked_clip.resize(0.3).set_pos(('center', 'bottom'))
final_clip = mp.CompositeVideoClip([
background,
masked_clip
]).set_duration(1)
final_clip.write_videofile('test.mp4')
For each video I selected individually the parameters.
clip.fx(mp.vfx.mask_color, color=[0, 255, 8], thr=100, s=5)
I left the "s" parameter unchanged. I only changed "thr" from 1 to 150 ... The higher the value of the parmatter, the better it removes the edges. But if it is too large, then the code starts to remove other colors besides green.
@mowshon would you like to propose a PR with your answer as a doc example?
@mgaitan yeah sure!
To be honest, I don't know how to solve your problem, but I want to recommend a website with green screen, maybe something would be interesting for you, and you will make something like that https://greenscreenstock.com/
Hello, I have succeed the fact to remove green on a image and to add a video in the background, but it doesn't work with a green screen video. How can I achieve that ?
Here is the code that works:
I want ai that is a ImageClip to be a VideoFileClip like a mp4 that as a green screen