Small script to reencode video files in x265 with HandBrake
- Resume:
Small script to easily reencode video with HandBrakeCLI.
- Version:
- Size:
- Download:
[ cmd + script ]
- License:
MIT License
- Copyrights:
Renan Lavarec
I wanted to convert my old video x264 to x265, I made a script for it :)

Small script to reencode video files in x265 with HandBrake


  • Python 3

  • HandBrake V1.4.2.0

How to use it

  • Execute the script :

Copy paste the file into the directory root to encode all files.

After executing the script, it will encode all video files into x265 !
    py tr.encode_this_folder_x265.py 


Command line options:

  • '–sourcesDir'

    • Give the folder roots to encode into x265 \'–sourcesDir "c:\dir 1" "c:\dir 2"\'

    • default=current dir

  • '–handbrake'

    • Give the folder for handbrake "C:\Program Files\HandBrake\HandBrakeCLI"

    • default="C:\Program Files\HandBrake\HandBrakeCLI"

  • '–forceDisplayDefaultSubtitle'

    • Force the subtitle to be loaded by default (Set a number for the subtitle to force, set to "1"

    • default="none"

  • '–q'

    • Quality index (set to "22", "no precise detail", set to "23" for anime, set to "21" for better details) )

    • default="21"

  • '–restartEncodingAll'

    • Erase previous encoding in x265 and restart all encoding

  • '–deleteAllSourceAlreadyEncoded'

    • Erase source already encoded in x265

  • '–deleteAllNewEncoded'

    • Erase all x265 encoded file with source, to enable to restart an encoding

  • '–deinterlace'

    • Deinterlace the video, remove the the blurry of 2 image in 1, Remove Jagged Artifacts

If needed, you can update the script

  • Edit the python script:

    • You can add some other excluded path inside "listExcludedPath"

    • You can add some other video file extension inside "listExtensions"

    • You can change the encoding suffix name "encodingSuffix"