Skip to content
/ ViCo Public

ViCo is a robust Bash utility for recursively finding, validating, and compressing video files within a directory. It leverages `ffmpeg` for encoding and automatically detects available hardware acceleration (NVIDIA NVENC, Intel QSV, or VAAPI) to significantly speed up the process.

License

Notifications You must be signed in to change notification settings

badmark/ViCo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

ViCo - Recursive Video Compressor (TUI Edition)

ViCo (vicomp.sh) is a robust, menu-driven Bash utility for recursively optimizing video collections. It features a text-based user interface (TUI) for easy configuration, automatic hardware acceleration detection (NVENC, QSV, VAAPI), and intelligent error handling for robust batch processing.

Features

  • Interactive Menu (TUI): A user-friendly text interface to browse directories and toggle settings without memorizing flags.
  • Hardware Acceleration: Automatically detects and prioritizes:
    1. NVIDIA NVENC
    2. Intel QSV (Quick Sync Video) - Uses explicit iHD driver handling.
    3. VAAPI (Intel/AMD Generic)
    4. CPU (Software Fallback)
  • Robust Path Handling: Safely handles filenames with spaces, special characters, and executes reliably even if the shell environment is unstable.
  • Smart Audio: * Default: Copies audio streams bit-for-bit (no quality loss).
    • Downmix: Optional mode to re-encode and downmix multi-channel audio to Stereo AAC.
  • Live Reporting: Generates a detailed HTML report (vico_report.html) that:
    • Auto-refreshes every 5 seconds during processing.
    • Tracks Original Size, New Size, Percentage Reduced, and Encoding FPS.
    • Summary: Displays total storage space saved (MB/GB) and total execution time upon completion.
  • Safety: Includes signal trapping to clean up temporary files if the script is interrupted (Ctrl+C).

Prerequisites

The script will attempt to auto-install dependencies if they are missing (supports Debian/Ubuntu, Fedora/RHEL, Arch, OpenSUSE).

  • bash
  • ffmpeg (Required): For video encoding.
  • ffprobe (Required): For video stream validation.
  • dialog (Required): For the interactive menu interface.
  • subliminal (Optional): Required only if using the -s flag for subtitles.

Usage

1. Interactive Mode (Recommended)

Simply run the script. It will launch a graphical menu in the terminal allowing you to browse for a folder and configure settings.

./vicomp.sh

2. Command Line / Headless

You can bypass the menu by providing flags or a directory argument.

./vicomp.sh [FLAGS] [DIRECTORY]

Flags

Flag Description
-h, --help Show help message.
--menu Force launch of the interactive configuration menu.
-k, --keep Keep Mode: Do NOT overwrite original files. Saves as _optimized.mp4.
-s, --subs Subtitles: Download subtitles matching system language.
-r, --res VAL Resolution: Target vertical resolution (720, 1080, 2160).
--no-hw Force Software: Disable hardware acceleration.
--downmix Downmix Audio: Re-encode audio to Stereo AAC (Default is Copy).
--no-recursive Flat Scan: Process only the target folder, ignoring subdirectories.
--html Report: Generate vico_report.html with live stats.

Examples

Open the Menu for the current directory:

./vicomp.sh

Headless 1080p compression (Overwrite originals, Copy Audio):

./vicomp.sh /media/movies

Process current folder only (no subfolders), Downmix audio:

./vicomp.sh --no-recursive --downmix .

Force CPU encoding for 4K files with HTML report:

./vicomp.sh --no-hw --html -r 2160 /path/to/videos 265 24

Installation

  1. Save the script code to a file named vicomp.sh.
  2. Make the script executable:
    chmod +x vicomp.sh
  3. Run it:
    ./vicomp.sh

About

ViCo is a robust Bash utility for recursively finding, validating, and compressing video files within a directory. It leverages `ffmpeg` for encoding and automatically detects available hardware acceleration (NVIDIA NVENC, Intel QSV, or VAAPI) to significantly speed up the process.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages