Intentionally simple transcoding scripts
-
Inspect your source material with
inspect.py
. It will print stream information that should help you decide which streams you want to keep -
Remux your source to normalise it using
remux.py
. Use-a
to select audio tracks,-s
to select subtitle tracks, and-f
for force a subtitle track, if desired. -
Check cropping with
preview-crop.py
. It will openmpv
with thedrawbox
filter to show what the detected crop is, and it will put acrop.txt
file with the detected crop in the current working directory. -
Transcode with
hevc-encode.py
. Ifcrop.txt
is found next to the source, it will automatically be used for crop information. Use--dry-run
to see the HandBrakeCLI command. For a rough idea: it'll take the video track and transcode it to a 10-bit HEVC video using x265; it'll select the first audio track and convert it to E-AC3, at varying bitrates depending on channels. It will add all subtitles in their current format, burning the first forced track
Each tool has its own dependencies, I've tried to keep them as minimal as possible. Each command needs to be accessible on your $PATH
inspect.py
depends onffprobe
andmkvmerge
remux.py
depends onmkvmerge
preview-crop.py
depends onffprobe
,ffmpeg
, andmpv
hevc-encode.py
depends onHandBrakeCLI
, and optionallymkvpropedit
- Drop the
.py
files somewhere in your$PATH
. - Get
HandBrakeCLI
from here: https://handbrake.fr/downloads2.php, drop it in your$PATH
- Get
ffmpeg
andffprobe
from here: https://ffmpeg.org/download.html, drop them in your$PATH
(look for static builds) - Get
mkvmerge
andmkvpropedit
from here: https://mkvtoolnix.download/downloads.html, drop them into your$PATH
- Get
mpv
from here: https://mpv.io/installation/, drop it in your$PATH