# transcode2H265 FFmpeg wrapper for unattended video transcoding to H265 codec, in MKV containers. ## Video Video stream is transcoded to H265 using libx265 encoder. Video is encoded in 10 bits to preserve HDR, or to improve SDR video overall quality. ## Audio All audio streams are either transcode to AAC, using native FFmpeg aac encoder, or copied as they are, depending on the `--audio-codec` option. Language, and other audio metadata is preserved. ## Subtitle All internal subtitles are copied, preserving language and any other metadata. External subtitles are ignored. ## Installation As a python script you can just run the transcode2H265.py file, or put a symbolic link in any directory of your PATH (e.g. /usr/local/bin) The script needs `ffmpeg` installed and in your PATH to work, and if it can not find them in your system it will complain and exit. The script depends on the following Python libraries: * sys * os * time * random * subprocess * string * argparse ## Default use Just do: `transcode2H265.py video_file[s]` ### Options ``` -h, --help show this help message and exit -p, --preset {ultrafast,superfast,veryfast,faster,fast,medium,slow,slower,veryslow} X265 preset [default: slow]. -q, --crf CRF CRF value [default: 26]. Determines the output video quality. Smaller values gives better qualities and bigger file sizes, bigger values result in less quality and smaller file sizes. Default value results in a nice quality/size ratio. CRF values should be in the range of 0 to 51. -a, --audio-codec {copy,aac} Output audio codec. You may transcode all input audio streams into aac (preserving their channels), or copy the input streams as they are [default: aac]. -b, --aac_audio_bitrate_per_channel AAC_AUDIO_BITRATE_PER_CHANNEL AAC audio bitrate per channel (in kb/s) [default: 96]. Ignored if audio codec not aac. Maximum audio bitrate is determined by the audio stream with more channels. -x, --filename-postfix FILENAME_POSTFIX Postfix to be added to newly created H.265 video files [default: _h265]. -t, --threads THREADS Indicates the number of processor cores the script will use. 0 indicates to use as many as possible, or current libx265 library defaults [default: 0]. ffmpeg may or may not respect this. -v, --version Show program's version number and exit. ```