-
-
Save mikemhenry/78d2071f96caed806e8fc6c340b06b75 to your computer and use it in GitHub Desktop.
Converts Dolby Vision Profile 5 encoded video files into format acceptable to Plex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
origfile="$(realpath "${1}")" | |
basefile="$(basename "${origfile}")" | |
basedir="$(dirname "${origfile}")" | |
ext="${basefile##*.}" | |
newfile="$(basename -s "${ext}" "${origfile}")nodv.${ext}" | |
echo "Transcoding File ${basefile} in ${basedir}..." | |
# Yanked from jellyfin Dolby Vision Profile 5 transcode example | |
# https://github.com/jellyfin/jellyfin/commit/3beda02d925c74c7a7083eaee733537f3396ec92 | |
# https://github.com/jellyfin/jellyfin-ffmpeg/pull/151/files | |
docker run -v "${basedir}":/data:rw --runtime=nvidia --entrypoint /usr/lib/jellyfin-ffmpeg/ffmpeg jellyfin/jellyfin \ | |
-init_hw_device cuda=cu:0 \ | |
-filter_hw_device cu \ | |
-hwaccel cuda \ | |
-hwaccel_output_format cuda \ | |
-threads 1 \ | |
-autorotate 0 \ | |
-i "/data/${basefile}" \ | |
-movflags use_metadata_tags \ | |
-map 0 \ | |
-autoscale 0 \ | |
-threads 0 \ | |
-codec:v:0 h264_nvenc \ | |
-preset p1 \ | |
-b:v 21000000 \ | |
-maxrate 21000000 \ | |
-bufsize 81398350 \ | |
-profile:v:0 high \ | |
-g:v:0 72 \ | |
-keyint_min:v:0 72 \ | |
-vf setparams=color_primaries=bt2020:color_trc=smpte2084:colorspace=bt2020nc,tonemap_cuda=format=yuv420p:p=bt709:t=bt709:m=bt709:tonemap=bt2390:peak=100:desat=0 \ | |
-c:a copy \ | |
-c:s copy \ | |
"/data/${newfile}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment