{"id":18582859,"url":"https://github.com/ankitt20/ffmpeg_whatsapp","last_synced_at":"2025-07-28T10:34:26.023Z","repository":{"id":250934177,"uuid":"835904194","full_name":"ankitT20/FFmpeg_whatsapp","owner":"ankitT20","description":"PowerShell Script for Reducing Video Size and Quality using FFmpeg","archived":false,"fork":false,"pushed_at":"2025-05-13T23:12:09.000Z","size":31,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-14T00:35:07.466Z","etag":null,"topics":["ffmpeg-script","ffmpeg-wrapper"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","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/ankitT20.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}},"created_at":"2024-07-30T18:54:52.000Z","updated_at":"2025-05-13T23:12:12.000Z","dependencies_parsed_at":"2024-12-26T17:21:42.093Z","dependency_job_id":"d48f8075-395a-427c-909c-dc3b212f2087","html_url":"https://github.com/ankitT20/FFmpeg_whatsapp","commit_stats":null,"previous_names":["ankitt20/ffmpeg_whatsapp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ankitT20/FFmpeg_whatsapp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitT20%2FFFmpeg_whatsapp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitT20%2FFFmpeg_whatsapp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitT20%2FFFmpeg_whatsapp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitT20%2FFFmpeg_whatsapp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ankitT20","download_url":"https://codeload.github.com/ankitT20/FFmpeg_whatsapp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ankitT20%2FFFmpeg_whatsapp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267502599,"owners_count":24098176,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"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":["ffmpeg-script","ffmpeg-wrapper"],"created_at":"2024-11-07T00:15:47.231Z","updated_at":"2025-07-28T10:34:25.968Z","avatar_url":"https://github.com/ankitT20.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FFmpeg_whatsapp\nPowerShell Script for Reducing Video Size and Quality using FFmpeg to exactly 94MB for WhatsApp  \n## Requirements:  \n```FFmpeg``` is required to run the project  \n1. Open an **administrative PowerShell** *(press Windows key, search powershell and right-click Run as administrator)*\n2. Run the following *(right click on terminal for paste or Ctrl+V)*: \n```\nSet-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/ankitT20/FFmpeg_whatsapp/refs/heads/main/ReduceVideoQuality.ps1'))\n```\n\u003c!-- If you want to install yt-dlp: ```choco install yt-dlp``` --\u003e\n### Manual Method (NOT RECOMMENDED)  \n\u003cdetails\u003e\n\u003csummary\u003eClick to see the process\u003c/summary\u003e\n\u003c!-- ### Download ffmpeg via Official website: \n[FFmpeg download website for windows](https://www.gyan.dev/ffmpeg/builds/#release-builds)  \n[Direct Download link](https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z) use [7-Zip](https://www.7-zip.org) for extraction.\nffmpeg.exe will be inside ```bin``` folder, copy the folder path including bin.  \nSearch Environment Variables open ```Edit the system environment variables```, Go to Environment Variables, Under System variables(bottom box), double click ```Path```, click New, paste folder path, click ok, ok.  \n### Instructions to run ReduceVideoQuality.ps1:\n1. Download ReduceVideoQuality.ps1 file *from github*\n\u003e    - *OR  Download Repository as Zip and Extract*\n\u003e    - *OR ```git clone https://github.com/ankitT20/FFmpeg_whatsapp.git```*\n2. Ensure *ReduceVideoQuality.ps1* and input video file are all in same directory/*folder*.\n3. Right click *ReduceVideoQuality.ps1*, click **Run with PowerShell**.\n\u003e    - *OR Open PowerShell, navigate to the directory containing the script, and run it using ```.\\ReduceVideoQuality.ps1```.*\n4. Follow the prompts to provide the filename and select options.  \n\u003e [!NOTE]\n\u003e If running scripts is dissabled on your system, search powershell, *Right click and 'Run as Administrator'*, and run the following:  ```Set-ExecutionPolicy Bypass -Scope Process```  \n\u003e [!TIP]\n\u003e After work is completed: ```Set-ExecutionPolicy -ExecutionPolicy Undefined```  \n\u003e To view all policy: ```Get-ExecutionPolicy -List```   --\u003e\n\u003ch3\u003eDownload ffmpeg via Official website:\u003c/h3\u003e\n\u003cp\u003e\u003ca href=\"https://www.gyan.dev/ffmpeg/builds/#release-builds\"\u003eFFmpeg download website for windows\u003c/a\u003e\u003cbr\u003e\u003ca href=\"https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z\"\u003eDirect Download link\u003c/a\u003e use \u003ca href=\"https://www.7-zip.org\"\u003e7-Zip\u003c/a\u003e for extraction.\nffmpeg.exe will be inside \u003ccode\u003ebin\u003c/code\u003e folder, copy the folder path including bin.\u003cbr\u003eSearch Environment Variables open \u003ccode\u003eEdit the system environment variables\u003c/code\u003e, Go to Environment Variables, Under System variables(bottom box), double click \u003ccode\u003ePath\u003c/code\u003e, click New, paste folder path, click ok, ok.  \u003c/p\u003e\n\u003ch3\u003eInstructions to run ReduceVideoQuality.ps1:\u003c/h3\u003e\n\u003col\u003e\n\u003cli\u003eDownload ReduceVideoQuality.ps1 file \u003cem\u003efrom github\u003c/em\u003e\u003cblockquote\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cem\u003eOR  Download Repository as Zip and Extract\u003c/em\u003e\u003c/li\u003e\n\u003cli\u003e\u003cem\u003eOR \u003ccode\u003egit clone https://github.com/ankitT20/FFmpeg_whatsapp.git\u003c/code\u003e\u003c/em\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/blockquote\u003e\n\u003c/li\u003e\n\u003cli\u003eEnsure \u003cem\u003eReduceVideoQuality.ps1\u003c/em\u003e and input video file are all in same directory/\u003cem\u003efolder\u003c/em\u003e.\u003c/li\u003e\n\u003cli\u003eRight click \u003cem\u003eReduceVideoQuality.ps1\u003c/em\u003e, click \u003cstrong\u003eRun with PowerShell\u003c/strong\u003e.\u003cblockquote\u003e\n\u003cul\u003e\n\u003cli\u003e\u003cem\u003eOR Open PowerShell, navigate to the directory containing the script, and run it using \u003ccode\u003e.\\ReduceVideoQuality.ps1\u003c/code\u003e.\u003c/em\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003c/blockquote\u003e\n\u003c/li\u003e\n\u003cli\u003eFollow the prompts to provide the filename and select options.\u003c/li\u003e\n\u003c/ol\u003e\n\u003cblockquote\u003e\n\u003cp\u003e[!NOTE] \nIf running scripts is dissabled on your system, search powershell, \u003cem\u003eRight click and \u0026#39;Run as Administrator\u0026#39;\u003c/em\u003e, and run the following:  \u003ccode\u003eSet-ExecutionPolicy Bypass -Scope Process\u003c/code\u003e  \u003c/p\u003e\n\u003cp\u003e[!TIP] \nAfter work is completed: ```Set-ExecutionPolicy -ExecutionPolicy Undefined```  \nTo view all policy: \u003ccode\u003eGet-ExecutionPolicy -List\u003c/code\u003e  \u003c/p\u003e\n\u003c/blockquote\u003e\n\n\u003c/details\u003e\n\n# Documentation\n## For Reducing video quality\n\u003e [!TIP]\n\u003e Similar to x264, the x265 encoder has 2 rate control algorithms:  \n\u003e Constant Rate Factor (CRF)  \n\u003e 2-pass target bitrate  \n### higher crf means reduced quality , range is 0 to 51\n```\nffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4\nffmpeg -i input.mp4 -vcodec libx265 -crf 23 output.mp4\nffmpeg -i input.mp4 -c:v libx265 -crf 26 -preset fast -c:a aac -b:a 128k output.mp4\n```\ndefault crf value is 23, and libx265 is HEVC (*High Efficiency Video Coding*) , for x264 [refer](https://unix.stackexchange.com/questions/28803/how-can-i-reduce-a-videos-size-with-ffmpeg)\n\n### for lossless\n```\nffmpeg -i input.mp4 -vcodec libx265 -x265-params lossless=1 output.mp4\n```\nverify using console output - x265 [info]: Rate Control                        : Lossless\n\n\n# For WHATSAPP higgest quality video 94MB limit, without sending as document.\nAs of 14 May 2025: (Android WhatsApp V2.25.14.76) HD LIMIT: 94MB, SD LIMIT: 67MB\n### Two-Pass Encoding\n## for 94MB video\ncalculate bitrate  \n752000 / 349 = 2154  \n94(desired file size) * 8(byte to bit) * 1000(MB to KB) / 349(**duration of video in seconds**) = 2154 (do multiplication first)  \n2154 - 128 kBit/s (desired audio bitrate) = 2026 kBit/s video bitrate\n```\nffmpeg -y -i input.mp4 -c:v libx265 -b:v 2026k -x265-params pass=1 -an -f null NUL \u0026\u0026 ^\nffmpeg -i input.mp4 -c:v libx265 -b:v 2026k -x265-params pass=2 -c:a aac -b:a 128k output.mp4\n```\n## for 94MB video without audio\ncalculate bitrate  \n94 * 8000 / 349 = 2154  \n94(desired file size) * 8(byte to bit) * 1000(MB to KB) / 349(**duration of video in seconds**) = 2154 (do multiplication first)  \n752000 / [duration of video in seconds]\n```\nffmpeg -y -i input.mp4 -c:v libx265 -b:v 2154k -x265-params pass=1 -an -f null NUL \u0026\u0026 ^\nffmpeg -i input.mp4 -c:v libx265 -b:v 2154k -x265-params pass=2 -an output_64MB.mp4\n```\n### for 94MB video without audio with Framerate of 30FPS\n```\nffmpeg -y -i input.mp4 -c:v libx265 -b:v 2154k -r 30 -x265-params pass=1 -an -f null NUL \u0026\u0026 ^\nffmpeg -i input.mp4 -c:v libx265 -b:v 2154k -r 30 -x265-params pass=2 -an output_64MB.mp4\n```\n[Refrence](https://trac.ffmpeg.org/wiki/Encode/H.265#Ratecontrolmodes)  \n\n## Speed up video and audio at the same time:\n\u003e Using a complex filtergraph (low quality),  \n\u003e For 3x: \n```\nffmpeg -i input.mp4 -filter_complex \"[0:v]setpts=0.3*PTS[v];[0:a]atempo=3.0[a]\" -map \"[v]\" -map \"[a]\" output.mp4\n```\n\u003e For 2x: ```ffmpeg -i input.mp4 -filter_complex \"[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]\" -map \"[v]\" -map \"[a]\" output.mp4```  \n\n### Slow Down video and audio at the same time:\n\u003e raw bitstream method\n```\nffmpeg -fflags +genpts -r 15 -i raw.h264 -i input.mp4 -map 0:v -c:v copy -map 1:a -af atempo=0.5 -movflags faststart output.mp4\n```\n[Refrence](https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video)  \n\n## Speed Up or Slow Down a Video(without audio)  \n\u003e For 3x speed (LOW QUALITY) (to slow PTS*3)  \n```ffmpeg -i 'input.mp4' -filter:v \"setpts=PTS/3,fps=60\" -an output.mp4```  \n\u003e For 3x speed (lossless) where 0.3 is 1/3 in decimal representation. *(this will create 100fps+ video, so -r 30 is MANDATORY afterwords)*  \n```ffmpeg -itsscale 0.3 -i 'input.mp4' -c copy -an fast.mp4```  \n  \n## Change framerate  \n\u003e Change framerate without re-encoding *(won't reduce file size to 64MB afterwards, but still -r 30 is MANDATORY if using reduce size commands)*:  ```(./ffmpeg -y -i input.mp4 -an -c copy -f h264 seeing_noaudio.h264) ; (./ffmpeg -y -r 30 -i seeing_noaudio.h264 -an -c copy fps.mp4)```  \n  \n\u003e [!TIP]\n\u003e All links are saved at Internet Archive [Wayback Machine](https://web.archive.org)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankitt20%2Fffmpeg_whatsapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fankitt20%2Fffmpeg_whatsapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankitt20%2Fffmpeg_whatsapp/lists"}