Skip to content

Instantly share code, notes, and snippets.

@Trogious
Last active January 2, 2026 17:33
Show Gist options
  • Select an option

  • Save Trogious/a04b8316ab52d17c13457ad7deb0d997 to your computer and use it in GitHub Desktop.

Select an option

Save Trogious/a04b8316ab52d17c13457ad7deb0d997 to your computer and use it in GitHub Desktop.
#!/bin/sh -
for f in `ls *.mkv`
do
OUT=`echo -n $f | sed -nE 's/.+(S[[:digit:]][[:digit:]]E[[:digit:]][[:digit:]]).+\.mkv/\1/p'`
ffmpeg -i "$f" \
-map 0 \
-map -0:t \
-map_metadata -1 \
-map_chapters 0 \
-vf "zscale=w=2560:h=1440:t=linear:npl=100,
format=gbrpf32le,
zscale=p=bt709,
tonemap=tonemap=hable:desat=0,
zscale=t=bt709:m=bt709:r=tv,
format=yuv420p10le" \
-c:v libx265 -crf 16 -preset slow \
-pix_fmt yuv420p10le \
-dolbyvision 0 \
-x265-params "colorprim=bt709:transfer=bt709:colormatrix=bt709" \
-bsf:v filter_units=remove_types=62 \
-c:a copy -sn \
-threads 14 -filter_threads 4 \
${OUT}.mkv > ${OUT}.log 2>&1
/home/ec2-user/notify.sh "$?" "$OUT"
done
sleep 10 && sudo /sbin/poweroff
# -benchmark -benchmark_all \
# sudo nice -n -20 ./hdr4KtoSDR1440p_ec2_c7i_4xlarge.sh
# Static ffmpeg binary for C7i: https://bit.ly/ffmpeg801c7i2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment