Skip to content

tarpetos/cleanvid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cleanvid

Platform Shell


cleanvid downloads, strips metadata, re-encodes, and standardizes video files with parallel terminal progress. It is built as a single Bash script for Linux shell workflows.


Contents


Features

Area What it does
Parallel processing Handles multiple inputs concurrently instead of processing one file at a time.
Download mode Downloads remote videos with wget, then sends successful downloads into the sterilization phase.
Metadata removal Uses FFmpeg metadata and bit-exact flags to remove container and stream metadata.
Standard output Produces H.264 video with AAC audio in an .mp4 container.
Encoder selection Supports NVIDIA h264_nvenc by default and CPU libx264 with -c cpu.

Requirements

Command Required for
ffmpeg Re-encoding and metadata removal
ffprobe Duration detection for progress calculation
awk / gawk Numeric formatting and progress math
tput Terminal cursor control for live progress
wget Remote download mode only

The install command also uses curl to download the script.

On Debian/Ubuntu, install the required runtime tools with:

sudo apt install curl ffmpeg gawk wget ncurses-bin

Installation

Install cleanvid directly into /usr/local/bin:

sudo sh -c 'curl -fsSL https://raw.githubusercontent.com/tarpetos/cleanvid/master/cleanvid -o /usr/local/bin/cleanvid && chmod +x /usr/local/bin/cleanvid'

After that, run it from anywhere:

cleanvid

To update later, run the install command again:

sudo sh -c 'curl -fsSL https://raw.githubusercontent.com/tarpetos/cleanvid/master/cleanvid -o /usr/local/bin/cleanvid && chmod +x /usr/local/bin/cleanvid'

Usage

cleanvid [-c cpu|cuda] [-k] [-w] INPUT1 [INPUT2 ...]
Option Meaning
-c cpu Encode video with CPU using libx264.
-c cuda Encode video with NVIDIA h264_nvenc. This is the default mode.
-k Keep original input files after successful processing.
-w Treat inputs as remote URLs and download them before processing.

By default, successful local inputs are removed after the sanitized output is written. Use -k when you want to keep the original files.


Examples

Local Video File

Process one local file:

cleanvid sample-5s-360p.mp4

Process multiple local files:

cleanvid vacation.mp4 wedding.mov

Keep the original local file:

cleanvid -k sample-5s-360p.mp4

Web Video URL

Download and process a remote file:

cleanvid -w https://samplelib.com/mp4/sample-5s-360p.mp4

Download, process, and keep the downloaded source file:

cleanvid -w -k https://samplelib.com/mp4/sample-5s-360p.mp4

Use CPU encoding:

cleanvid -c cpu sample-5s-360p.mp4

More examples are available in examples/README.md.


Sample Video

You can use this small public MP4 for testing:

https://samplelib.com/mp4/sample-5s-360p.mp4

To download it locally:

wget -O sample-5s-360p.mp4 https://samplelib.com/mp4/sample-5s-360p.mp4

How It Works

  1. Inputs are collected from local file paths or remote URLs.
  2. In wget mode, remote files are downloaded to temporary files first.
  3. Each successful input is probed with ffprobe to read its duration.
  4. Files are processed in parallel with ffmpeg.
  5. Metadata is stripped and streams are re-encoded to H.264/AAC.
  6. Outputs are written as sequential videoN.mp4 files.
  7. Source files are removed after successful processing unless -k is used.

FFmpeg is invoked with metadata stripping and bit-exact flags:

-map_metadata -1
-fflags +bitexact
-flags:v +bitexact
-flags:a +bitexact

Output filenames avoid existing videoN.mp4 files in the current directory.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages