Rembg Virtual Greenscreen Edition (Dr. Tim Scarfe)
Rembg Virtual Greenscreen Edition is a tool to create a green screen matte for videos
Video Virtual Green Screen Edition
15th Jan 2021 -- made a new YouTube explainer
- Take any video file and convert it to an alpha matte to apply for a virtual green screen
- It runs end-to-end non-interactively
- You need ffmpeg installed and on your path
- There is also a powershell script
./remove-bg.ps1which will do the job in a manual way i.e. first create frames, then run therembg -p ...command and then runffmpegto create the matte movie. This was my first approach to solve this problem but then I migrated onto just making a new version of rembg.
If you have any ideas for speeding this up further, please let us know. We have tried quite a few things at this stage and are a bit stuck on how to proceed from here. See some of the "evolution" in the Whimsical notes.
Usage;
pip install rembg-greenscreen
greenscreen -g "path/video.mp4"
Experimental parallel green screen version;
greenscreen --parallelgreenscreen "path/video.mp4" --workernodes 3 --gpubatchsize 5
The command above will produce a video.matte.mp4 in the same folder, also works with mov and avi extensions. Uses ffmpeg under the hood to stream and re-encode the frames into a grayscale matte video.
Be careful with the default parameters, my 11GB GPU is already pretty much maxed with 3 instances of the NN with 5 image gpu batches in forward pass.
You can see how much free GPU ram you have with
nvidia-smi
CLI interface
Important notes
- Don't use VBR videos, it will run forever -- use Handbrake to convert them to CFR
References
- https://arxiv.org/pdf/2005.09007.pdf
- https://github.com/NathanUA/U-2-Net (thanks to these folks for making the semantic segmentation model and publishing online)
License
- Copyright (c) 2020-present Daniel Gatis
- Copyright (c) 2020-present Dr. Tim Scarfe
- Copyright (c) 2020-present Lucas Nestler (Making it go faster and more stuff running on the GPU, thanks Lucas!)
Licensed under MIT License
Metadata
Release files for rembg-greenscreen 2.1.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rembg_greenscreen-2.1.10-py3-none-any.whl | Python 3 | none | any | Details for rembg_greenscreen-2.1.10-py3-none-any.whl |
Release files / rembg_greenscreen-2.1.10-py3-none-any.whl
| Download URL | rembg_greenscreen-2.1.10-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a5f469691bebc273ee166bcd0713beddb9e486264c41cc3ba2d2dd1a877fdb3
|
|
BLAKE2b-256 checksum How to use checksums |
e54b21167890c6c91d831474c6b12805dd7a0306da98ca14114fd70b1112614a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.5
|
Security for rembg-greenscreen 2.1.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.