Skip to content

seth-tribbey/rembg_from_video

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

rembg_from_video

Uses ffmpeg-python and rembg to attempt removal of a background from a video file.

Two directories will be created in the same directory as the script to hold the video frames (before and after rembg is applied).

Installation:

Install rembg by following their instructions

rembg specifically requires Python 3.9 as of the time of this writing. Note that you must choose the rembg[gpu] version and configure onnxruntime accordingly if you wish to use your GPU for the image processing.

Then:

pip install ffmpeg-python

Usage:

python .\rembg_video.py [-h] [-a] [-af AF] [-ab AB] [-ae AE] [--skip-extract] [--skip-process] input

positional arguments:
  input           Input video

optional arguments:
  -h, --help      show this help message and exit
  -a              Turns on alpha matting during background removal
  -af AF          Alpha matting foreground threshold
  -ab AB          Alpha matting background threshold
  -ae AE          Alpha matting erode size
  --skip-extract  Skips ffmpeg frame extraction
  --skip-process  Skips rembg frame processing

Tip: Alpha matting can be used to refine the results

Example:

About

Attempt removal of a background from a video file.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages