Skip to content

python scripts to transcode given file(s) to HEVC and compare output to source

License

Notifications You must be signed in to change notification settings

magnolialogic/python-hevc_transcoder

Repository files navigation

python-hevc_encoder

Tools to transcode video files into HEVC, experiment with different encoder presets and options, and pixel-peep/compare the source file to your HEVC output. Default presets were created using source content with fast-moving subjects / high framerate (motorsport).

setup.py

python script to manage $PATH symlink to transcode.py.

usage: setup.py [-h] (--install | --uninstall)

Manages $PATH symlink for transcode.py

optional arguments:
  -h, --help   show this help message and exit
  --install    install symlink to transcode.py on $PATH
  --uninstall  remove symlink to transcode.py


transcode.py

python script to transcode movies to HEVC using custom encoder options based on source file's resolution. This has only been tested with H.264 MP4 files, but should work with source files with any of the following extensions: ".mp4", ".m4v", ".mov", ".mkv", ".mpg", ".mpeg", ".avi", ".wmv", ".flv", ".webm", ".ts" but YMMV.

usage: transcode.py [-h] [--file FILE | --all] [--quality QUALITY] [--preset PRESET] [--baseline | --best] [--small]
                    [--delete]

Transcodes given file(s) in ./source/ to HEVC format.

optional arguments:
  -h, --help         show this help message and exit
  --file FILE        relative path to movie in source directory
  --all              transcode all supported movies in source directory
  --quality QUALITY  HandBrake quality slider value (-12,51)
  --preset PRESET    override video encoder preset
  --baseline         use baseline encoder options
  --best             use highest quality encoder options
  --small            use additional encoder options to minimize filesize at the expense of speed
  --delete           delete output files when complete/interrupted


compareEncoding.py

python script to compare screenshots of source and transcoded files.

usage: compareEncoding.py [-h] [-s] filename [num_frames]

positional arguments:
  filename     Source filename
  num_frames   Number of comparison frames to generate

optional arguments:
  -h, --help   show this help message and exit
  -s, --stack  Also create 2-up stacked comparison


Notes:

Dependencies:



Installation:

python3 /path/to/setup.py --install



Tips:

You can also compare multiple encodes created with different presets by appending preset names to the HEVC filename. e.g.

compareEncoding.py
└── source 
    └── test.mp4
└── hevc
    ├── test-RF18.mp4
    └── test-RF24.mp4

About

python scripts to transcode given file(s) to HEVC and compare output to source

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages