Giter VIP home page Giter VIP logo

ffmpeg_whatsapp's Introduction

FFmpeg_whatsapp

For Reducing video quality using FFmpeg

Requirements:

FFmpeg is required to run the project FFmpeg download website for windows
Direct Download link use 7-Zip for extraction. ffmpeg.exe will be inside bin folder, copy it to ReduceVideoQuality.ps1 location

Instructions to run ReduceVideoQuality.ps1:

  1. Download ReduceVideoQuality.ps1 file from github
    • OR Download Repository as Zip and Extract
    • OR git clone https://github.com/ankitT20/FFmpeg_whatsapp.git
  2. Ensure ffmpeg.exe is in the same directory/folder as the ReduceVideoQuality.ps1 and video file.
  3. Select and Right click ReduceVideoQuality.ps1, click Run with PowerShell.
    • OR Open PowerShell, navigate to the directory containing the script, and run it using ReduceVideoQuality.ps1.
  4. Follow the prompts to provide the filename and select options.

If running scripts is dissabled on your system, search powershell, Right click and 'Run as Administrator', and run the following: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

Documentation

For Reducing video quality

higher crf means reduced quality , range is 0 to 51

ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4
ffmpeg -i input.mp4 -vcodec libx265 -crf 23 output.mp4
ffmpeg -i input.mp4 -c:v libx265 -crf 26 -preset fast -c:a aac -b:a 128k output.mp4

default crf value is 23, and libx265 is HEVC (High Efficiency Video Coding) , for x264 refer

for lossless

ffmpeg -i input.mp4 -vcodec libx265 -x265-params lossless=1 output.mp4

verify using console output - x265 [info]: Rate Control : Lossless

For WHATSAPP higgest quality video 64MB limit, without sending as document.

Two-Pass Encoding

for 64MB video without audio

calculate bitrate

64 * 8000 / 349 = 1467

64(desired file size) * 8(byte to bit) * 1000(MB to KB) / 349(duration of video in seconds) = 1467 (do multiplication first)

ffmpeg -y -i input.mp4 -c:v libx265 -b:v 1467k -x265-params pass=1 -an -f null NUL && ^
ffmpeg -i input.mp4 -c:v libx265 -b:v 1467k -x265-params pass=2 -an output_64MB.mp4

for 64MB video

calculate bitrate

64 * 8000 / 349 = 1467

64(desired file size) * 8(byte to bit) * 1000(MB to KB) / 349(duration of video in seconds) = 1467 (do multiplication first)

1467 - 128 kBit/s (desired audio bitrate) = 1339 kBit/s video bitrate

ffmpeg -y -i input.mp4 -c:v libx265 -b:v 1339k -x265-params pass=1 -an -f null NUL && ^
ffmpeg -i input.mp4 -c:v libx265 -b:v 1339k -x265-params pass=2 -c:a aac -b:a 128k output.mp4

Refrence

ffmpeg_whatsapp's People

Contributors

ankitt20 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.