← all repositories
nadermx/backgroundremover

Strip image and video backgrounds without leaving the terminal

This free, offline CLI removes backgrounds from images and video because most alternatives are either browser subscriptions or image-only scripts.

backgroundremover
Not currently ranked — collecting fresh signals.
star history

What it does BackgroundRemover is a Python command-line tool that segments foreground subjects from images and video using PyTorch-based u2net models. It can emit transparent PNGs, alpha-channel ProRes .mov files, matte keys for Premiere, or composite a subject onto a new background image or video. It runs locally, auto-detects a CUDA GPU for speed, and falls back to CPU if necessary.

The interesting bit The video pipeline is the unusual part: it processes frames in parallel, then re-encodes them into professional codecs like ProRes 4444 or VP9 with alpha, which is the kind of output you usually expect from a compositor, not a terminal one-liner. It also exposes an HTTP API server mode, so you can turn the CLI into a local microservice without writing a wrapper.

Key highlights

  • Supports batch processing for both image folders and video folders.
  • Offers alpha matting with tunable erosion thresholds for sharper or softer edges.
  • Swaps between three segmentation models: general u2net, human-optimized u2net_human_seg, and a faster u2netp variant.
  • Reads from stdin and writes to stdout for image pipeline integration.
  • Auto-detects CUDA and falls back to CPU; the README cites roughly 5–10× speed-ups on GPU.

Caveats

  • Transparent video output defaults to ProRes 4444, which most web browsers and VLC struggle to play correctly; the authors recommend mpv, QuickTime, or professional editors like DaVinci Resolve.
  • Docker users need to manually increase shared memory (--shm-size=2g) for video processing, or multiprocessing crashes with an OSError.
  • HEIC/HEIF image support requires an extra dependency (pillow-heif), and pipe mode works only for images, not video.

Verdict Video editors, data-augmentation pipelines, and developers building local media tools should keep this handy. If you only need the occasional selfie cutout, a browser tool is probably less fuss.

Frequently asked

What is nadermx/backgroundremover?
This free, offline CLI removes backgrounds from images and video because most alternatives are either browser subscriptions or image-only scripts.
Is backgroundremover open source?
Yes — nadermx/backgroundremover is open source, released under the MIT license.
What language is backgroundremover written in?
nadermx/backgroundremover is primarily written in Python.
How popular is backgroundremover?
nadermx/backgroundremover has 8k stars on GitHub.
Where can I find backgroundremover?
nadermx/backgroundremover is on GitHub at https://github.com/nadermx/backgroundremover.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.