Skip to content

About

Process all .mp4 video files in a folder, removes metadata, chapters, and EXIF/GPS data, and performs a re-encoding using exclusively FFmpeg and ExifTool.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

29 Commits

Folders and files

Repository files navigation

683437326-7f5d6f6b-d564-460e-bb64-c4c3eee5bcb9_github

VideoCleaner

A simple Bash script to batch-clean .mp4 videos for private sharing.

It re-encodes videos to widely supported H.264/AAC MP4, removes unnecessary metadata, chapters, and EXIF/GPS data, and saves the cleaned copies in a separate output folder. Original files are never modified.

Uses only FFmpeg and ExifTool.
Pure, simple, direct.
100% Shell script.

 

Always be paranoid

Congratulations! You’ve just downloaded a whole bunch of videos from the web!
But do you really know what’s hiding inside those files in your folder?!
Exactly how many videos are there?

Come on — do you honestly intend to examine every single downloaded clip, every video you’ve grabbed from social media or external libraries...?
Of course not.
You’d end up wasting an endless amount of time inspetting data over dozens of videos in that folder...

The problem

Some files may contain tracking systems, cryptocurrency malware, or mining programs.
They can use them as a confirm that you actually possess the file... so I know that you saw.
Most of that are AI-generated files.
But the AI Agents are always active and can use us, exactly in this way: just waiting data comes back.
And by default, you simply AGREED the moment you performed the action...

So, be careful — don’t let yourself get infected or leave any traces behind.


See more

 

Useful resources

Exif tool online service: exif.tools

Features

  • Batch-processes every .mp4 file in a source folder
  • Re-encodes video to H.264 and audio to AAC for broad device compatibility
  • Scales video to 1080p while preserving the original aspect ratio
  • Removes container metadata, chapters, XMP, EXIF, and GPS data
  • Keeps original videos untouched
  • Lets you limit CPU usage by setting the number of FFmpeg threads

Requirements

  • Bash
  • FFmpeg
  • ExifTool

On Debian/Ubuntu, install them with:

sudo apt update
sudo apt install ffmpeg libimage-exiftool-perl

Installation

Clone the repository:

git clone https://github.com/gubi/VideoCleaner.git
cd VideoCleaner

Make the script executable:

chmod +x clean_up_video.sh

Usage

Run the script from the folder containing your videos:

./clean_up_video.sh [SOURCE_FOLDER] [OUTPUT_FOLDER] [THREADS] [AUDIO_KBPS]

Or specify the source folder, output folder, and maximum number of threads:

./clean_up_video.sh ./videos ./clean 2

Arguments

Argument Description Default
SOURCE_FOLDER Folder containing the .mp4 files to process .
OUTPUT_FOLDER Folder where cleaned videos are saved clean
THREADS Maximum number of FFmpeg threads/cores to use 2
AUDIO_KBPS Audio bitrate in kbps 96

Examples

Process the current folder and save cleaned files to ./clean:

./clean_up_video.sh

Process /path/to/videos and save the results in /path/to/output:

./clean_up_video.sh /path/to/videos /path/to/output

Process ./videos, save output to ./output, and use 1 thread:

./clean_up_video.sh . clean 2 96 1

Compress to approximately 50% of the original size. Change "0.70" in the TARGET_RATIO variable below to "0.50". Lower thread counts reduce CPU usage but increase processing time. For minimal CPU impact, use 1.

What the script does

For each input video, the script:

  1. Re-encodes the video stream using libx264 (H.264).
  2. Re-encodes the audio stream using AAC at 128 kbps.
  3. Scales the video to a maximum height of 1080 pixels.
  4. Removes global metadata and chapters.
  5. Removes XMP, EXIF, and GPS metadata with ExifTool.
  6. Saves the result as <original-name>_clean.mp4 in the output folder.

Important notes

  • The script processes files matching *.mp4 in the top level of the source folder; it does not recursively process subfolders.
  • Re-encoding is intentionally used to improve compatibility and remove potentially problematic codecs or metadata.
  • Metadata removal reduces privacy risks, but it cannot guarantee the removal of information embedded in unusual tracks or visually present in the video itself.

License

This project is licensed under the MIT License.

About

Process all .mp4 video files in a folder, removes metadata, chapters, and EXIF/GPS data, and performs a re-encoding using exclusively FFmpeg and ExifTool.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Contributors

Languages