Remove unwanted visuals and object from video programmatically

August 22, 2025
7 Min
Video Engineering
Share
This is some text inside of a div block.
Join Our Newsletter for the Latest in Streaming Technology

A content operations manager at a European social video platform told us about a recurring problem. Their team reviews over 500 videos a day, most of them solid enough to publish, but a few always come back with issues, a brand logo they don’t own, an inappropriate poster in the background, or a distracting object that moderation flagged. With only three people on the moderation team, they can’t afford to send every video into a full editing cycle. What they needed was a faster, automated way to remove or mask unwanted visuals, so flagged content could move through their pipeline without delays.

And this isn’t a one-off case. The same challenge shows up across many industries. UGC platforms see users upload content at volumes that human editors can’t possibly keep up with. Newsrooms often license footage from agencies but need to blur or mask elements before it can air. Even education platforms find themselves re-editing otherwise valuable lectures because a background element violates compliance rules.

The common thread: the content itself is good, but specific visuals make it unpublishable without edits. That’s where automated object removal steps in.

Three practical ways to automate unwanted visual removal

FFMPEG

FFmpeg is usually the first thing you reach for when you need a fix fast and don’t care too much about how it looks. If your moderation system can flag timestamps and bounding boxes, it’s easy enough to script a job that applies a blur, pixelate, or black box over the region and re-encodes the output. No GPU, no ML pipeline, no orchestration. It works well for static, predictable visuals, things like corner logos, watermarks, or faces that don’t move.  

But that’s also where it stops. FFmpeg doesn’t track motion, doesn’t rebuild what’s behind the object, and the blur itself is usually very visible. It’s the kind of solution you use when the goal is “make this compliant now,” not “make this clean.” And that’s fine, especially when you need speed, control, and zero infrastructure overhead.  

ML-based object removal

Video inpainting models like LaMa, RTMPose-guided pipelines, or Stable Diffusion-based tools can reconstruct missing pixels with eerie accuracy. But getting this working in production isn’t just about running a model. You’ll need to chain detection, tracking, and inpainting together, make sure the mask follows the object across frames, and apply temporal smoothing so the output doesn’t flicker. It can look incredible when tuned properly, the object’s just gone, cleanly replaced by background that never existed.

But this comes with real overhead: GPU orchestration, failure handling, model versioning, retraining, and a moderation pipeline that doesn’t fall apart when one part breaks. If you’ve got the engineering muscle, the infra, and the need for pixel-perfect edits, this is the most powerful tool in the toolbox.

API-Based Removal

Most platforms don’t want to build their own removal pipeline. You’re already juggling uploads, moderation, playback, analytics. Adding GPU queues and inpainting logic to that? Not worth it.

An API-based approach or platform like FastPix solves this cleanly. Your moderation system flags the issue, a logo, a background object, a sensitive visual. Instead of kicking it to an editor or spinning up a rendering job, you pass the flagged segment to the API. The object is tracked across frames, removed using inpainting or blur, and the output is returned, ready to stream or swap into your playlist.

In the sections below, we’ll walk through how this works using the FastPix API

Step-by-Step guide to removing unwanted visuals with FastPix

FastPix makes it easy to remove unnecessary sections from a video using its API. Whether you need to eliminate mistakes, interruptions, or irrelevant content, you can specify the segments to remove and let FastPix handle the edits automatically.

Step 1: Identify unwanted segments

Before making any API requests, determine the start and end times for the segments you want to remove. For example, in a 10-second video, if you want to cut out sections from 2-5 seconds and 7-9 seconds, note these timestamps carefully.

Tip: Ensure your timestamps precisely cover the unwanted content to avoid cutting out important parts of the video.

Step 2: Configure the JSON request with expunge segments

FastPix allows you to specify the segments to remove using the expungeSegments field in a JSON request.

If creating new media from a URL

Use the create media from url API to upload and edit a video in one step.

Example JSON Request:

1{
2  "inputs": [
3    {
4      "type": "video",
5      "url": "https://static.fastpix.io/sample.mp4",
6      "expungeSegments": ["2-5", "7-9"]
7    }
8  ],
9  "accessPolicy": "public",
10  "maxResolution": "1080p"
11}

In this case, FastPix removes the specified segments while keeping the rest of the video intact.

If uploading new media from a device

For direct file uploads, use the upload media from device API.

Example JSON Request:

1{
2  "corsOrigin": "*",
3  "pushMediaSettings": {
4    "inputs": [
5      {
6        "type": "video",
7        "expungeSegments": ["2-5", "7-9"]
8      }
9    ],
10    "metadata": {
11      "key1": "value1"
12    },
13    "accessPolicy": "public",
14    "maxResolution": "1080p"
15  }
16}

If editing an existing media file

To remove segments from a video that has already been uploaded to FastPix, use its media ID instead of a URL.

Example JSON request:

1{
2  "inputs": [
3    {
4      "type": "video",
5      "url": "fp_mediaId://14206796-a1f5-4b9f-a086-2595802425d8",
6      "expungeSegments": ["4-6", "15-19"]
7    }
8  ],
9  "accessPolicy": "public",
10  "maxResolution": "1080p"
11}

Here, FastPix removes the segments from 4-6 seconds and 15-19 seconds, leaving the rest untouched.

Step 3: Submit your API request

Once your JSON request is ready, send it through the FastPix API. The system processes the request, removing the specified segments and generating the final edited video.

Example scenario

If your original video is 10 seconds long and you remove two segments (2-5 seconds and 7-9 seconds), the final output will be 5 seconds long, seamlessly edited without quality loss.

Best practices for optimal results

Use precise timestamps: Ensure start and end times match the unwanted content.

Avoid over-cutting: Keep the narrative intact by only removing truly unnecessary sections.

Preview edited videos: Always review the output to confirm that all edits are as expected.

What you can actually build with this


Manual object selection with frame-level accuracy

Not every removal needs to be automated. Sometimes you just want to give your editors or reviewers a clean way to fix a specific issue, like masking a brand logo or removing a background sign. With manual selection, you can build that.

Let users pause the video, draw a box, and apply a blur or removal, without needing timeline scrubbers or editing software. This works especially well when paired with clipping tools, so users can trim the moment and fine-tune it immediately after.

If you’re building a frontend for moderation or compliance workflows, manual selection gives teams control without needing post-production tools or external review steps.

Timeline-based removal for structured edits

When you’re dealing with high-volume content or system-generated flags, manual review becomes the bottleneck. That’s where timeline-based removal works better.

You pass in the exact time ranges and regions that need to be removed, maybe based on moderation results, maybe tied to specific events. The system takes care of tracking, masking, stitching, and re-encoding the video behind the scenes.

This lets you process flagged content at scale, without giving up precision and without putting every video through a manual review queue.

Integrated NSFW filtering for automated moderation

If you're building a platform with UGC, education, or news content, moderation isn’t optional. But catching violations is only half the problem, the real challenge is acting on them automatically.

By integrating NSFW detection into your processing flow, you can scan flagged segments in real time, get frame-level results, and either remove or blur the problem areas directly.

It’s especially useful when paired with clipping or trimming workflows. Instead of reviewing everything manually or holding back entire videos, you can fix the issue and move on, without slowing down your pipeline or relying on human editors.

A developer-first way to remove unwanted visuals

Most editing tools are built for editors. FastPix isn’t. It’s built for developers who’d rather fix a video with an API call than open a timeline. You define what needs to be removed, an object, a region, a time range and the system handles tracking, cleanup, and re-encoding.  

Remove content without slowing everything else down

Editing shouldn't be a bottleneck. Especially when the rest of your pipeline, uploads, moderation, playback, is already automated. With FastPix, cleanup happens as part of that flow. What used to take hours in post gets handled in seconds, with no handoffs.

Designed to work whether you're processing one video or a thousand

Manual edits are fine when you're dealing with a few files. But once you're reviewing hundreds of videos per day, even small tasks become operational overhead. FastPix is built for pipelines, not timelines, so the same workflow works whether you're removing one object or batch-processing an entire catalog.

Make precise edits without compromising quality

Sloppy edits don’t cut it. FastPix gives you frame-level control, so you can remove exactly what you need, without touching the rest. Whether it's blurring, cutting, or inpainting, the output holds up across devices, formats, and delivery platforms.

Ending Note…

Some parts of a video just don’t belong. A background distraction, a stray logo, something that breaks the tone, or worse, something that shouldn’t be there at all.

You don’t need to jump into an editor for every fix. Sometimes all it takes is a timestamp, a region, and a call to the right API. Whether you're cleaning up highlights or removing flagged content, it's about making the video clearer, safer, and more intentional, without slowing everything else down.

And if you're thinking about moderation more broadly, not just fixing what gets through, but catching it early,  we’ve got that covered too. FastPix includes built-in NSFW and profanity detection through the same API layer. So if you're building a safety net around your content, it's all there. You can sign up and start with 25 free credits or just reach out if you’d rather talk it through first. We're here when you need us.

FAQs

How can I automate the process of removing unwanted sections from a video without manual editing?

Automating video editing can be done using an API that allows you to specify exact timestamps or time ranges for unwanted sections. By defining the start and end times of the segments to be removed, the API will process the video and seamlessly remove the specified content while keeping the rest of the footage intact.

What is the best way to handle large video libraries and remove irrelevant content at scale?

For large video libraries, batch processing with an API is an effective approach. You can configure the API to automatically remove unwanted sections based on predefined criteria, such as time-based removal or content filtering. This allows you to streamline the editing process across a large volume of content without the need for manual intervention.

What are the most effective ways to improve video editing workflows for content creators?

Optimizing video editing workflows can be achieved by automating tedious tasks, such as removing irrelevant sections, clipping unnecessary footage, and applying content filtering. Using advanced APIs that handle these tasks with precision can significantly reduce editing time while improving content quality.

Get started

Enjoyed reading? You might also like

Try FastPix today!

FastPix grows with you – from startups to growth stage and beyond.