2024-12-06, 06:41 PM
Here's the full command I used for that messed up encode:
It's a piece of media I struggled with to get a reasonable size or much of a reduction at all with av1_qsv, so I was trying to reduce it to 720p and keep bitrate high. The result is what you see above. Reproducible through multiple encodes.
Code:
MEDIA="Media" && INPUT="Media.mkv" && \
cd "/mnt/media/Media" && \
mkdir -p "/mnt/media/${MEDIA}" && \
echo "Calculating crop values..." && \
cropval=$(jffmpeg -ss 300 -i "${INPUT}" -t 5:00 -filter:v fps=1/2,cropdetect -f null - 2>&1 | awk '/crop/ { print $NF }' | tr ' ' '\n' | sort | uniq -c | sort -n | tail -1 | awk '{ print $NF }') && \
cw=$(echo "${cropval#*crop=}" | cut -d : -f 1) && ch=$(echo "${cropval#*crop=}" | cut -d : -f 2) && \
cx=$(echo "${cropval#*crop=}" | cut -d : -f 3) && cy=$(echo "${cropval#*crop=}" | cut -d : -f 4) && \
jffmpeg -init_hw_device qsv=qs:/dev/dri/renderD129 -hwaccel qsv -hwaccel_output_format qsv -qsv_device /dev/dri/renderD129 -filter_hw_device qs \
-analyzeduration 200M -probesize 1G -extra_hw_frames 40 -i "${INPUT}" \
-map 0:v:0 -map 0:a:0 -map 0:s:0 \
-c copy -c:v:0 "av1_qsv" -preset "veryslow" -low_delay_brc 1 -extbrc 1 -look_ahead_depth 40 \
-adaptive_i 1 -adaptive_b 1 -b_strategy 1 -bf 39 \
-global_quality:v:0 22 \
-filter:v "hwupload=extra_hw_frames=40,vpp_qsv=cw=${cw}:ch=${ch}:cx=${cx}:cy=${cy}:denoise=8:format=p010le,scale_qsv=mode=2:h=720:w=-1" \
-filter:s "hwupload=extra_hw_frames=40,vpp_qsv=scale_mode=2:w=1920:h=-1" \
-c:a libopus -b:a 192k -ac 2 \
-metadata title="${MEDIA}" \
-metadata:s:a:0 title='Stereo' -metadata:s:a:0 language='eng' -disposition:a:0 default \
-metadata:s:s:0 title='English' -metadata:s:s:0 language='eng' -disposition:s:0 0 \
"/mnt/media/${MEDIA}/${MEDIA} [Bluray-720p AV1 10bit OPUS 2.0][JA][EN].mkv"
It's a piece of media I struggled with to get a reasonable size or much of a reduction at all with av1_qsv, so I was trying to reduce it to 720p and keep bitrate high. The result is what you see above. Reproducible through multiple encodes.
Jellyfin 10.10.0 LSIO Docker | Ubuntu 24.04 LTS | i7-13700K | Arc A380 6 GB | 64 GB RAM | 79 TB Storage