Setup: Plex \ Settings \ Live TV & DVR \ DVR Settings \ Postprocessing Script = full path to the script
plexEncode.sh <file> <encoder> <remove_original>
<encoder> = ffmpeg # .mp4 file output. uses hevc_nvenc and adds hvc1 for MacOS compatibility - modify $ffmpeg_options to your specs. (Hardware Nvidia Transcoding on Pascal GPU or higher)
= handbrake # .m4v file output. - modify $handbrake_options to your specs. (Software Transcoding)
<remove_original> = 0 # keep original input file.
= 1 # delete original input file.
# encode a single file using default encoder and original file handling set in script
plexEncode.sh "file"
# encode a single file using handbrake, remove the original file
plexEncode.sh "file" handbrake 1
# encode a single file using ffmpeg, keep the original file
plexEncode.sh "file" ffmpeg 0
# loop thru a directory containing multiple .ts files
for i in *.ts; do plexEncode.sh "$i" ; done
Script to add handbrake/ffmpeg/mediainfo/etc packages to your plex/sonarr/radarr dockers; https://gist.github.com/scrathe/ba29e50d95f71bfb207ccf6f74a425a7