FFmpeg, PHP - script to do Chroma Key (green screen) background removal in video file
This project received 1 bids from talented freelancers with an average bid price of $150 AUD.Get free quotes for a project like this
A user has uploaded a video to my server. The video content shows a person in the foreground, and a green background.
I need a script that will remove the green background, and output a new video file with a transparent background.
The script must return the file path to the output video, so I can use that file in other scripts on the server.
Possibly, you will need to use FFmpeg to export each frame in the video as an image, then compare each pixel in the image with the color green. If green, then set the pixel to transparent. After analysing every frame, join all the frames back together and save as a video file.
FFmpeg documentation says you will also need to split the audio and visual channels first, before you work on the pixel colors. Then recombine the audio and video at the end.
Allow some tolerance when checking the pixel color. For example, instead of an exact match at rgb values 0,128,0 (green), allow some variation so that if the pixel is dark green or light green it is still made transparent. A way to do this might be to use a distance formula in 3D color space.
Looking to make some money?
- Set your budget and the timeframe
- Outline your proposal
- Get paid for your work
Hire Freelancers who also bid on this project
Looking for work?
Work on projects like this and make money from home!Sign Up Now
- The New York Times
- Wall Street Journal
- Times Online