I Got Tired of Videos With Inconsistent Volume, So I Automated the Fix

12 min read

Normalize Video Clip batch-normalizes the audio in an entire folder of videos, fixes awkward legacy containers, and does it without unnecessarily re-encoding compatible video streams.

I have a lot of video files.

Screen recordings.

Phone clips.

Downloaded videos.

Old footage.

Random clips created by different software over the years.

And there is one thing they almost never agree on:

volume.

One video is barely audible.

The next one blasts through the speakers.

Then another sounds fine until I switch back to something older.

If you’re dealing with a mixed video library, this gets annoying very quickly.

I could open every file in an editor.

Adjust the audio manually.

Export it.

Repeat.

But once the folder contains dozens or hundreds of files, that stops being a reasonable workflow.

So I built Normalize Video Clip.

It’s an open-source Python tool built on FFmpeg that takes a folder of videos and creates a new folder where the audio has been normalized to a consistent loudness target.

By default:

-16 LUFS.

Point it at a directory.

Let it process the batch.

Get back a much more consistent video library.

The Problem Isn’t Just “Turn the Volume Up”

There is an important difference between making audio louder and normalizing loudness.

If I simply increase every file by the same number of decibels, I haven’t really solved anything.

A very quiet recording and an already-loud recording don’t need the same adjustment.

What I actually want is for the clips to end up around a similar perceived loudness.

That’s where LUFS comes in.

LUFS stands for Loudness Units relative to Full Scale.

Unlike a simple peak measurement, LUFS is designed to better represent how loud audio sounds to a listener.

Normalize Video Clip uses FFmpeg’s loudness-normalization capabilities and targets -16 LUFS by default. The target can be changed through the tool’s configuration.

The goal is simple:

when I move from one clip to another, I shouldn’t immediately reach for the volume control.

Why -16 LUFS?

There isn’t one universal loudness target for every possible use case.

Broadcast.

Music streaming.

Podcasts.

YouTube.

Personal archives.

They can all have different conventions.

For this tool, I wanted a practical default for general video playback rather than a broadcasting standard.

So Normalize Video Clip defaults to -16 LUFS.

The important part is not that everyone should use exactly -16 LUFS.

The important part is that the entire batch uses the same target.

If you have a different workflow, the target is configurable.

Don’t Re-Encode Video Unless You Have To

This was one of the bigger design requirements for me.

If I only need to fix the audio, I don’t want to re-encode every video stream for no reason.

Video encoding takes time.

It can reduce quality.

It uses a lot more CPU.

And it creates unnecessary work.

So for compatible containers, Normalize Video Clip keeps the video stream untouched and focuses on normalizing the audio.

Conceptually:

Original video stream ───────────────┐
                                     ├──► Output video
Original audio ─► loudness normalize ┘

That means the expensive part of the media file doesn’t need to be recreated just because the audio level was inconsistent.

This is the kind of optimization I like.

Not clever for the sake of being clever.

Just avoiding work that doesn’t need to happen.

Legacy Formats Complicate Things

Of course, video files aren’t all MP4.

Old collections often contain things like:

  • .mpg
  • .mpeg
  • .webm

And container formats don’t all support the same combinations of video and audio codecs.

Normalize Video Clip standardizes the audio around AAC.

But some legacy containers aren’t appropriate for carrying AAC audio.

So for .mpg, .mpeg, and .webm inputs, the tool automatically converts the output container to MP4 rather than creating an invalid or awkward codec/container combination.

For example:

old-video.mpg

may become:

old-video.mp4

The result isn’t just more consistent loudness.

It’s also a collection that is generally easier to play with modern software and devices.

One Folder In, One Folder Out

I intentionally kept the command-line workflow simple.

You provide:

  1. an input directory
  2. an output directory

For example:

normalize-videoclip ./videos ./videos_normalized

The tool scans the input directory and processes the supported video files into the destination.

I prefer this over modifying the originals in place.

It gives me a clean separation:

videos/
    original files
videos_normalized/
    processed files

If something doesn’t look right, the source material is still there.

For media-processing scripts, I think that is a much safer default.

Preview the Entire Job Before Changing Anything

Batch-processing media makes me nervous.

Especially when the batch is large.

Before I let a tool process hundreds of files, I want to know:

  • which files it found
  • what outputs it plans to create
  • which ones will be skipped
  • which containers will change

So Normalize Video Clip includes a dry-run mode.

normalize-videoclip ./videos ./videos_normalized --dry-run

The dry run previews what the batch would do without touching the files.

It doesn’t even require FFmpeg to be installed because no actual media processing happens.

That gives me a workflow I trust much more:

plan first

then:

execute

Especially with automation, I think that separation is important.

The Tool Is Designed to Be Safe to Restart

Long-running batch jobs fail.

Maybe I stop the process.

Maybe the machine reboots.

Maybe one video is malformed.

Maybe something crashes.

A tool that assumes every run will finish perfectly isn’t very useful.

So Normalize Video Clip is designed to be safe to re-run.

If an output file already exists, it is skipped by default.

If I intentionally want to redo it, I can use the overwrite option.

But there is another detail that matters even more.

Files are written to a temporary location first

The tool does not immediately write an output directly to its final filename and hope FFmpeg finishes.

Instead, the encode is written to a temporary file.

Only after processing completes successfully is that file moved into the final destination.

Why?

Imagine the computer loses power halfway through this:

video.mp4

If the partially encoded file is already sitting in the destination directory under its final name, the next run might see:

video.mp4 exists

and assume the work is finished.

That’s bad.

The temporary-file approach makes the state much cleaner:

Successful encode
      ↓
atomic move
      ↓
final output

If the process dies before completion, there is no valid final output to mistakenly skip later.

This is one of those boring engineering details that I care about much more than flashy features.

Processing a Large Library in Parallel

For a small folder, processing videos sequentially is fine.

For a large library, it can be slow.

Normalize Video Clip can process multiple files in parallel using worker processes.

For example:

normalize-videoclip ./videos ./videos_normalized -j 8

That runs the batch with eight workers.

Whether eight is a good number depends on the machine.

Media processing can be CPU intensive.

But if the hardware has available cores, parallel processing can significantly reduce the total time required for a large library.

The tool also lets you change the video quality target when re-encoding is required.

For example:

normalize-videoclip ./videos ./videos_normalized --crf 20 -j 8

Here, --crf 20 controls the video quality target for the files that actually need video re-encoding.

Save Your Settings Instead of Remembering Flags

Command-line flags are useful.

They are also easy to forget.

If I find a configuration that works well for a particular library, I don’t want to reconstruct the entire command six months later.

So Normalize Video Clip supports configuration files.

For example:

normalize-videoclip ./videos ./videos_normalized --config my.toml

CLI flags can still override the settings in the configuration file.

That gives me a nice balance.

Store the normal settings in one place.

Override something temporarily when necessary.

This is especially useful if the tool becomes part of a recurring workflow.

JSON Output Makes It Easier to Automate

Human-readable terminal output is great when I’m manually running the command.

It is less useful when another script is running it.

So the tool can return machine-readable JSON output:

normalize-videoclip ./videos ./videos_normalized --json

That makes the results easier to consume from:

  • shell scripts
  • Python
  • CI pipelines
  • scheduled jobs
  • automation platforms
  • monitoring systems

The repository also defines specific exit codes for things like failed encodes, invalid configuration, missing FFmpeg, or a missing input directory.

This is the point where a personal script starts becoming more useful as infrastructure.

Instead of only working when I sit at the terminal, it can become part of another system.

It Can Also Be Used as a Python Library

The CLI is just one interface.

The actual normalization logic is exposed as a Python library too.

That means another Python project can import the same core behavior rather than shelling out to a command.

Conceptually:

from normalize_videoclip import NormalizeConfig, normalize_directory

Then another application can provide its own configuration and consume the resulting batch summary.

I like this architecture because it prevents a common problem.

Sometimes a project starts with a CLI.

Then someone adds an API.

Then an agent integration.

Eventually all three contain slightly different logic and behave differently.

Here, the CLI, Python library, and MCP server sit on top of the same core normalization code.

One implementation.

Multiple interfaces.

And Yes, I Added MCP Support

Claude Code / MCP Agent
          │
          ▼
  check_environment
          │
          ▼
 plan_normalization
          │
          ▼
  normalize_videos
          │
          ▼
        FFmpeg

This is probably the most unusual part of the project.

Normalize Video Clip can also run as an MCP server.

MCP — Model Context Protocol — provides a structured way for AI agents to interact with external tools.

So instead of manually typing:

normalize-videoclip ...

an MCP-compatible agent can interact with the normalization workflow using defined tools.

The server exposes three operations:

check_environment

Checks whether the environment is ready.

For example, whether required software is available.

plan_normalization

Creates a read-only preview of what the batch would do.

No files are changed.

normalize_videos

Actually starts the normalization process.

The separation is deliberate.

An agent doesn’t need to jump directly from:

I found these videos.

to:

I’m modifying all of them.

It can inspect the environment.

Create a plan.

Show me the plan.

And only then perform the write operation.

I think that’s a much better model for agent-controlled file operations.

Human Workflow and Agent Workflow Use the Same Core

This is the part of the MCP integration I find most interesting.

The goal wasn’t to create a separate “AI version” of the application.

The workflow should remain the same.

For a human:

Inspect
  ↓
Dry run
  ↓
Normalize

For an agent:

check_environment
        ↓
plan_normalization
        ↓
normalize_videos

Same underlying idea.

Inspect before you mutate.

And because the MCP server is built on the same normalization engine as the CLI, I don’t need to maintain two implementations that slowly diverge.

A Note About MCP Security

MCP doesn’t magically sandbox the filesystem.

The repository is explicit about this.

The Normalize Video Clip MCP server runs locally and has the filesystem permissions of the user account running it. There is no additional path sandboxing built into the server itself.

That means if an agent can invoke the tool, you should treat its filesystem access seriously.

This is another reason I like separating preview operations from write operations.

Agents can be useful.

But for file-modification tools, I want predictable boundaries.

What’s Under the Hood?

The project is intentionally small.

The main requirements are:

  • Python 3.11+
  • FFmpegs

For the CLI itself, there are no additional runtime dependencies beyond the Python standard library and FFmpeg. The MCP integration is installed as an optional extra.

The basic architecture is:

Input folder
    │
    ▼
Normalize Video Clip
    │
    ├── inspect files
    ├── choose output container
    ├── normalize audio
    ├── preserve video when possible
    ├── re-encode when necessary
    │
    ▼
Output folder

FFmpeg does the heavy media work.

The Python layer handles the batch logic, configuration, safety checks, concurrency, output reporting, and integrations around it.

That’s usually the kind of architecture I prefer.

Use a mature tool for the hard low-level problem.

Build the workflow you actually need around it.

Installation

The project lives inside my Atomik Scripts repository.

Clone the repository:

git clone https://github.com/atomikfactory/atomik-scripts.git

Then enter the project:

cd atomik-scripts/python/audio/normalize-videoclip

For CLI-only usage:

pip install -e .

If you also want the MCP server:

pip install -e ".[mcp]"

You’ll also need FFmpeg available on your PATH.

Then the basic workflow is simply:

normalize-videoclip ./videos ./videos_normalized --dry-run

Check the plan.

Then:

normalize-videoclip ./videos ./videos_normalized

And let it process the folder.

Why Not Just Use a Video Editor?

You absolutely can.

For one or two important videos, I probably would.

A video editor gives you much more control.

You can listen.

Adjust individual clips.

Compress.

EQ.

Automate levels.

Fix problematic audio manually.

Normalize Video Clip is solving a different problem.

I don’t want to creatively mix 200 random archive videos.

I want those 200 videos to have reasonably consistent loudness without spending an afternoon opening them one by one.

That’s the difference between editing and batch processing.

One is about precision.

The other is about scale.

The Bigger Lesson: Automate the Boring Consistency Work

This project started because inconsistent video volume was annoying.

But the reason I enjoy building tools like this goes beyond audio.

Computers are extremely good at repetitive consistency.

Humans aren’t.

If the task is:

Listen carefully and decide whether this video sounds good.

That’s probably a human problem.

If the task is:

Apply the same measurable loudness standard to every video in this folder.

That’s a computer problem.

And once the workflow is reliable enough, I shouldn’t need to think about it again.

That’s what I wanted from Normalize Video Clip.

Not another video-editing application.

Not another giant media platform.

Just:

take this messy folder and make the audio consistent.

Safely.

Repeatably.

And without doing unnecessary work.


Atomik Factory is where I document the tools, scripts, software, and experiments I build for everyday use — around AI, technology, automation, privacy, finance, productivity, and whatever problem happens to annoy me enough to automate it.

Most projects start the same way.

Something is repetitive.

Something wastes time.

Or something feels harder than it needs to be.

So I build a small tool around it.

Then I document it for myself.

And if somebody else has the same problem, hopefully it helps them too.

Build. Learn. Share.

If you have an archive full of videos where every clip seems to have its own idea of what “normal volume” means, Normalize Video Clip is available in the Atomik Scripts repository on GitHub.

// tags