Giter VIP home page Giter VIP logo

ffmpeg-video-compressor's Introduction

FFmpeg video compressor

Simple command line tool to compress videos from a local folder using FFmpeg.

Instructions

Step 1 - Clone this repository to your local machine

git clone https://github.com/dmitsuo/ffmpeg-video-compressor.git

Step 2 - Download FFmpeg

You have to manually download FFmpeg command line tool from one of the sources below, depending on your system, and place its "ffmpeg" (Linux) or "ffmpeg.exe" (Windows) binary file inside the same folder where you clone this repository on your local filesystem
  • Microsoft Windows 10/11: https://www.gyan.dev/ffmpeg/builds
  • Linux: https://johnvansickle.com/ffmpeg
  • Other platforms: https://www.ffmpeg.org/download.html

    Step 3 - (OPTIONAL) Adjust video-compressor.[sh|bat] script if needed

    Optionnaly, you can change the conversion parameters of FFmpeg inside video-compressor.sh file (Linux) or video-compressor.bat file (Windows) to fit your needs or just accept the default values.

    We recommend that you stay with the default parameter values and only change them if the results are not acceptable.

    Those parameters are shown below:

    ## ... rest of the code ommited
    
    ### Parameters that you can change to fit your needs - BEGIN
    SOURCE_EXTENSIONS=("ts" "avi" "mkv" "mov" "webm" "mp4")
    CPU_USED="12"
    VIDEO_CONSTANT_RATE_FACTOR="26"
    AUDIO_BITRATE="32k"
    AUDIO_SAMPLING_RATE="32000"
    AUDIO_CHANNELS="1"
    ### Parameters that you can change to fit your needs - END
    
    ## ... rest of the code ommited

    REM ... rest of the code ommited
    
    REM Parameters that you can change to fit your needs - BEGIN
    set "SOURCE_EXTENSIONS=webm ts mp4 mkv avi mov"
    set "CPU_USED=12"
    set "VIDEO_CONSTANT_RATE_FACTOR=26"
    set "AUDIO_BITRATE=32k"
    set "AUDIO_SAMPLING_RATE=32000"
    set "AUDIO_CHANNELS=1"
    REM Parameters that you can change to fit your needs - END
    
    REM ... rest of the code ommited
    

    To get more details about FFmpeg parameters, please go to its documentation website: https://ffmpeg.org/ffmpeg.html

    Step 4 - Call video-compressor.[sh|bat] script

    To compress all video files in a given local folder, call the video-compressor.sh script (Linux) or the video-compressor.bat file (Windows) via the command line, passing the full path to the videos folder you want to compress, for example:

    • Linux
    ./video-compressor.sh "/path/to/my/videos/folder"

    • Windows
    video-compressor.bat "C:\Users\myusername\Videos"
    

    These scripts can be called without arguments, in which case they will prompt the user for the full path of the videos folder.

    The compressed video files will be saved in a folder called โ€œconverted_videosโ€, which will be created in the same source folder as the video files.

    Step 5 - (OPTIONAL) Call loop.[sh|bat] script if you need to compress video files continuously

    If you need this tool to compress video files uninterruptedly, as the files are created/copied in the source folder, run the loop.sh script (Linux) or the loop.bat file (Windows), as shown in the example below:

    • Linux
    ./loop.sh "/path/to/my/videos/folder"

    • Windows
    loop.bat "C:\Users\myusername\Videos"
    
  • ffmpeg-video-compressor's People

    Contributors

    dmitsuo avatar

    Stargazers

     avatar  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.