Skip to content

DeadLaurin/CompressVideo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Compress Video to x265 recursively

This script compresses videos to x265 (HEVC) from one location to another recursively without overwriting the destination.

blazingly fast

Features

  • Open Source bash script
  • Can run on Linux and Windows WSL
  • Can be run in a tmux session in the background
  • Compress all videos in subfolders and copy folder structure to destination
  • No complicated switches
  • If terminated, can be restarted and will not overwrite already created files
  • Will not delete or overwrite any existing files
  • Will not recompress a source video that's already in h265 (HEVC) format.
  • Has the option to select your desired Bitrate

Requirement

The script uses ffmpeg and can be install on Debian/Ubuntu based systems or Windows Subsystem for Linux (WSL) with:

apt install ffmpeg

Windows users, to find out more regarding WSL, use this link.

Download/Install script

To download and use the script, do the following in a folder of your choosing:

wget https://raw.githubusercontent.com/DeadLaurin/CompressVideo/main/compress_video.sh
chmod +x compress_video.sh

Now the script is ready to use. You could move the script to somewhere in your PATH if you'd like to access it from anywhere.

Usage

./compress_video.sh [-e EXTENSION] [-s SOURCE] [-d DESTINATION] [-b BITRATE]
        -e EXTENSION        Mandatory: Specify the file extension to filter on source. Eg: -e mkv
        -s SOURCE           Mandatory: Specify the source folder to compress from. Eg: -s /mnt/myvideos
        -d DESTINATION      Mandatory: Specify the destination folder to compress to. Note that files 
                                       will not be overwritten. Eg: -d /home/user/myvideos
        -b BITRATE        Specify the bitrate quality in kbps. Eg: -b 2000

Example

Compress MKV videos from location /mnt/videos to ~/videos with 2500 Bitrate

./compress_video.sh -e mkv -s /mnt/videos -d ~/videos -b 2500

The output might look like this:

Destination file exists: ~/videos/Season 1/video1.mkv
Destination file exists: ~/videos/Season 1/video2.mkv
Destination file exists: ~/videos/Season 1/video3.mkv
---------------------------------------------------------------------------------------------------------------------------------
Compressing  /mnt/videos/Season 1/video4.mkv  with size ( 1280 x 720 ) and with 31081 frames to file  ~/videos/Season 1/video4.mkv
---------------------------------------------------------------------------------------------------------------------------------
x265 [info]: HEVC encoder version 3.6+1-aa7f602f7
x265 [info]: build info [Linux][GCC 13.2.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [info]: Main profile, Level-4 (Main tier)
x265 [warning]: No thread pool allocated, --wpp disabled
x265 [warning]: No thread pool allocated, --lookahead-slices disabled
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 3 / none
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias  : 23 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : ABR-1500 kbps / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
x265 [info]: tools: b-intra strong-intra-smoothing deblock sao
frame=28275 fps= 15 q=20.0 size=  280320KiB time=00:18:04.79 bitrate=2116.9kbits/s speed=0.557x

About

bash script to compress videos to x265 recursively

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages