{"id":51081175,"url":"https://github.com/visual1mpact/8mb-video-compressor","last_synced_at":"2026-06-23T18:02:34.084Z","repository":{"id":340615837,"uuid":"1166853305","full_name":"Visual1mpact/8MB-Video-Compressor","owner":"Visual1mpact","description":"A simple Bash script that compresses videos to ~8MB using ffmpeg, designed for Termux and lightweight environments.","archived":false,"fork":false,"pushed_at":"2026-03-13T17:14:31.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-14T04:57:13.441Z","etag":null,"topics":["8mb-limit","aac","android-cli","bash","bitrate-calculation","cpu-multithreading","discord-upload","ffmpeg","ffmpeg-script","file-size-optimization","h264","libx264","linux","low-bitrate","media-processing","termux","two-pass-encoding","video-compression","video-encoder","video-optimization"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Visual1mpact.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-25T17:19:31.000Z","updated_at":"2026-03-13T19:13:13.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/Visual1mpact/8MB-Video-Compressor","commit_stats":null,"previous_names":["visual1mpact/8mb-video-compressor"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Visual1mpact/8MB-Video-Compressor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Visual1mpact%2F8MB-Video-Compressor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Visual1mpact%2F8MB-Video-Compressor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Visual1mpact%2F8MB-Video-Compressor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Visual1mpact%2F8MB-Video-Compressor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Visual1mpact","download_url":"https://codeload.github.com/Visual1mpact/8MB-Video-Compressor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Visual1mpact%2F8MB-Video-Compressor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34700915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["8mb-limit","aac","android-cli","bash","bitrate-calculation","cpu-multithreading","discord-upload","ffmpeg","ffmpeg-script","file-size-optimization","h264","libx264","linux","low-bitrate","media-processing","termux","two-pass-encoding","video-compression","video-encoder","video-optimization"],"created_at":"2026-06-23T18:02:29.444Z","updated_at":"2026-06-23T18:02:34.076Z","avatar_url":"https://github.com/Visual1mpact.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🎬 8MB Video Compressor (Termux)\n\nA smart Bash script that compresses videos to a **user-defined target size** using `ffmpeg`, designed for **Termux** and lightweight environments.  \n\n\u003e 💬 **Discord Note:** Discord currently allows **10MB uploads** for free users. The script defaults to **8MB** for safety but lets you choose another target size interactively at runtime.\n\nPerfect for:\n* Discord uploads (10MB free limit — 8MB default)\n* Quick file sharing\n* Mobile encoding via Termux\n* Low-resource Linux systems\n\n---\n\n## 📦 Features\n\n* 🎯 **User-selectable target output size (default 8MB)**\n* 🔁 2-pass encoding for accurate size targeting\n* 📊 Real-time progress bar\n* 🧠 Automatic bitrate calculation\n* 🔊 Smart audio/video bitrate allocation\n* 📐 Auto resolution detection\n* 📉 Auto downscale to 720p if width \u003e 1280px\n* ⚡ Uses all available CPU cores\n* 📱 Optimized for Termux \u0026 minimal systems\n* 🧹 Automatic temporary file cleanup\n\n---\n\n## 🛠 Requirements\n\nYou need:\n\n* `bash`\n* `ffmpeg`\n* `ffprobe`\n* `coreutils` (for `nproc`, usually preinstalled)\n\nInstall in Termux:\n\n```sh\npkg update\npkg install ffmpeg\n````\n\n---\n\n## 🚀 Usage\n\n```sh\nchmod +x compress8mb.sh\n./compress8mb.sh input.mp4 output.mp4\n```\n\nWhen running, you will be prompted:\n\n```text\nEnter target size in MB (default 8 MB):\n```\n\n* Press **Enter** to keep 8MB\n* Type `10` or any other number to change target size\n\nExample:\n\n```sh\n./compress8mb.sh video.mp4 compressed.mp4\n```\n\n---\n\n## ⚙️ How It Works\n\n1. Prompts for target size (default 8MB)\n2. Reads video duration using `ffprobe`\n3. Converts target size into total available kilobits\n4. Reserves **64 kbps** for audio\n5. Assigns remaining bitrate to video\n6. Downscales to **720p** if width \u003e 1280px\n7. Performs **2-pass encoding**:\n\n   * Pass 1: analysis\n   * Pass 2: final encode with progress tracking\n8. If file exceeds target:\n\n   * Reduces video bitrate by 5%\n   * Re-encodes automatically\n9. Cleans up temporary files\n\n---\n\n## 🧮 Bitrate Formula\n\n```bash\nTarget size (MB) × 8192 = total kilobits\nTotal kilobits ÷ duration (seconds) = total bitrate (kbps)\nVideo bitrate = total bitrate − audio bitrate\n```\n\n---\n\n## 📊 Example Output\n\n```text\n══════════════════════════════════════\nDuration: 120s\nTarget: 8MB\nVideo Bitrate: 482k\nAudio Bitrate: 64k\nThreads: 24\nScaling: 720p\nCodec: libx264 (2-pass)\n══════════════════════════════════════\nProgress: [##########################          ] 54% (65s/120s)\nDone: compressed.mp4 (~8MB)\n```\n\n---\n\n## ⚠️ Notes\n\n* Output size will **never exceed target**\n* Very long videos will have lower quality (bitrate constrained)\n* Very short videos may look very high quality\n* Uses all logical CPU cores detected via `nproc`\n* Designed for reliability over raw speed\n\n---\n\n## 🔧 Customization\n\nYou can **change the default prompt value** or modify audio/preset options:\n\n```bash\n# Default prompt value\nDEFAULT_TARGET_MB=8\n\n# Change audio bitrate (kbps)\nAUDIO_BITRATE=64\n\n# Change x264 preset\n-preset fast\n```\n\n---\n\n## 🆚 Why 2-Pass?\n\n2-pass encoding:\n\n* Improves bitrate distribution\n* Ensures accurate file size\n* Produces better quality at low bitrates\n* Guarantees ≤ TARGET_MB output\n\nThis version prioritizes **accuracy and reliability** while remaining lightweight.\n\n---\n\n## 📄 License\n\nMIT License — free to use and modify.\n\n---","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisual1mpact%2F8mb-video-compressor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvisual1mpact%2F8mb-video-compressor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvisual1mpact%2F8mb-video-compressor/lists"}