Preloader
Others
  • Estimated reading time: 5 Minutes

How to Remove Background Noise from a Demo Video Without Re-Encoding (FFmpeg)

How to Remove Background Noise from a Demo Video Without Re-Encoding (FFmpeg)

You record a nine-minute walkthrough for launch day. The code is right, the cursor never wanders, and the take is clean. Then you play it back on headphones. A Docker build had your laptop fan screaming the whole time, the air conditioner kicked in at minute four, and every pause hums.

Re-recording means doing the whole take again. Dropping the file into a video editor means a full export, which re-encodes every frame. On a screen recording, that second encode is where crisp monospace text turns soft.

There's a better path. The picture was never the problem, so leave it alone and replace only the soundtrack.

In short: measure the noise floor in a pause, extract the audio and clean it with a model built for non-steady noise, then mux the clean track back in with -c:v copy so the video stream is never decoded. Finish by hashing the video stream before and after to prove nothing changed.

Measure Before You Fix Anything

First, check which streams and codecs the file contains:

ffprobe -v error -show_entries stream=index,codec_type,codec_name,width,height -of compact demo.mp4

Screen recorders on macOS and Windows, as well as most phones, save H.264 or HEVC. That matters later, because both can be stream-copied into an MP4 untouched.

Next, find a two-second pause and measure its level:

ffmpeg -ss 00:00:04 -t 2 -i demo.mp4 -map 0:a:0 \
  -af astats=measure_perchannel=none:measure_overall=RMS_level \
  -f null -

The RMS level in the output is your noise floor, measured in dBFS (more negative means quieter). Run it on a pause from a recording you're happy with, too. The gap shows how much cleanup you need and gives you a baseline for afterward.

Why FFmpeg's Own Filters Fall Short

FFmpeg ships with built-in noise filters. afftdn reduces steady broadband noise. highpass=f=80 strips low rumble. arnndn runs a small RNNoise model, though you have to supply the model weights yourself.

They work best on stationary noise that never changes, like a constant mic hiss. Real rooms aren't that polite. A laptop fan ramps up mid-build. A dog barks twice. Traffic rolls past. Filters that rely on a static noise profile either let transient spikes through or eat into the voice trying to suppress them.

Neural models trained on speech handle this differently: they learn what a human voice sounds like and treat everything else as removable, whether it's steady or sudden. The EraseNoise team ran 24 real noisy recordings through their pipeline and scored each one before and after with two standard speech-quality models, one for background noise and overall quality, the other for voice naturalness. Both rate speech on a 1–5 scale:

Measure

Before

After

Background noise (average of 24)

2.45

4.13

Overall quality (average of 24)

2.14

3.18

Voice naturalness (average of 24)

1.98

3.90

Background noise, dog barking

1.23

4.20

Background noise, distant fan

1.48

4.24

Background noise, street noise

1.68

4.17

The naturalness line is the one to watch. Aggressive denoising often leaves speech thin and metallic. Here the voice scored higher after cleanup than before, because the background noise had been masking it.

Extract and Swap the Track Without Re-Encoding

First, pull the audio out into an uncompressed 48 kHz WAV to pass into your denoiser:

ffmpeg -i demo.mp4 -vn -c:a pcm_s16le -ar 48000 noisy.wav

Once your denoiser outputs clean.wav at the same duration as the original video, swap the soundtrack back in with one command:

ffmpeg -i demo.mp4 -i clean.wav \
  -map 0:v:0 -map 1:a:0 \
  -c:v copy -c:a aac -b:a 192k \
  -shortest -movflags +faststart \
  demo-clean.mp4

What each flag does:

  • -map 0:v:0 -map 1:a:0 takes the video stream from the original file and the audio stream from the WAV, dropping the noisy track completely.
  • -c:v copy passes compressed video packets straight through. Nothing is decoded or re-encoded, so the mux finishes in seconds with zero generation loss.
  • -c:a aac -b:a 192k encodes the clean soundtrack in a format every browser and player accepts.
  • -shortest stops at the end of the shorter input, preventing a few extra milliseconds of audio from leaving a frozen trailing frame.
  • -movflags +faststart moves the moov atom to the front of the container so the video starts playing in a browser before the full file downloads.

Two edge cases catch people here:

Trimming breaks stream copy. If you add -ss to cut the start, a copied video stream can only begin on a keyframe, which may sit seconds away from where the audio starts. If you need a trimmed clip, re-encode the video for that cut.

Some codecs don't fit in MP4. A WebM from a browser recorder often carries VP8 video, which the MP4 container can't hold, so FFmpeg refuses to write the file. Replace -c:v copy with a high-quality H.264 encode:

-c:v libx264 -preset veryfast -crf 20 -pix_fmt yuv420p

CRF 20 is a notch above x264's default of 23 (lower is sharper), and yuv420p keeps the file playable everywhere.

Prove the Picture Didn't Change

Don't take the flags on faith. Hash the compressed video stream of both files:

for f in demo.mp4 demo-clean.mp4; do
  ffmpeg -v error -i "$f" -map 0:v:0 -c copy -f md5 -
done

Two identical hashes confirm the video packets are byte-for-byte unchanged and only the audio track was replaced. If the hashes differ, check that clean.wav runs the full length of the video, since -shortest will otherwise drop the last frames.

Skip the Pipeline When You Just Need the File

Scripting this workflow makes sense if you clean recordings every week. If you just need a clean launch demo before Friday, EraseNoise runs the same chain in a browser tab.

You can upload an MP4, MOV, M4V, or WebM directly (up to 2 GB). A neural model cleans the speech, and the backend remuxes the result using stream copy for H.264 and HEVC, falling back to H.264 for codecs MP4 can't hold, like VP8, just like the command above. Before you pay anything, you can A/B a free 30-second preview of your noisiest section without creating an account. You can dial back the reduction strength to keep natural room tone, and download either the remuxed MP4 or a 48 kHz WAV the same length as the clip, starting at 00:00, for your timeline. Your first minute is free when you sign up, and uploads and outputs are deleted automatically after 24 hours.

If you're dealing with specific capture setups like phone clips, screen recordings, or camera footage, there's a dedicated guide on how to remove background noise from video that covers each source.

A Final Checklist

Before you publish a demo recording:

  1. Measure the noise floor of a pause in dBFS, and re-check it after cleanup.
  2. Review the result on headphones, not laptop speakers.
  3. Swap the soundtrack with -c:v copy unless you're trimming on non-keyframes.
  4. Hash the video stream to confirm the frames are untouched.

Your code was fine and the take was fine. The fan was the only thing wrong, and you fixed it without touching a single frame.

Related articles
Brother TN760 vs TN730 vs TN770: Which Toner Should You Buy?
25 Nov, 2026
  • Estimated reading time: 5 Minutes
Nano Banana 2 README and Docs Images Size Checklist
25 Nov, 2026
  • Estimated reading time: 5 Minutes
Superscript and Subscript Text You Can Paste Anywhere
25 Nov, 2026
  • Estimated reading time: 5 Minutes
Best Link Building Agencies for Organic Growth
25 Nov, 2026
  • Estimated reading time: 6 Minutes
Weekly trending
Brother TN760 vs TN730 vs TN770: Which Toner Should You Buy?
25 Nov, 2026
  • Estimated reading time: 5 Minutes
Nano Banana 2 README and Docs Images Size Checklist
25 Nov, 2026
  • Estimated reading time: 5 Minutes
Superscript and Subscript Text You Can Paste Anywhere
25 Nov, 2026
  • Estimated reading time: 5 Minutes
Our Sponsors

Our blog is proudly supported by industry-leading sponsors.