2023-09-13, 07:16 AM
Okay, an update. I posted a bit in the other topic, but this is dedicated to AV1. I'm refining my tactics and have a bit of a template going on...I'm going with two-pass ABR since that's about all I can get to work with av1_qsv at the moment and it gives me the best bang for my buck with a variety of different media. Quick and dirty script:
Still haven't figured out the best way to automate selection for a bunch of stuff. Beginning to reach my limits on bash scripting, partially because I'm just writing these to copy and paste into the shell. I'll probably throw together a Python script or two in the coming days to see if I can get anything working on that front with a bit more friendly UX and maybe some deeper exploration of files.
Code:
# input file path
MEDIA="/path/to/media.mkv" && \
# output file template without extras or file extension
OUTPUT="/path/to/media" && \
# clean title (optional)
CLNTTL=""
# quality indicator
QUALITY="Bluray" && \
# resolution indicator
RES="2160p" && \
# release group indicator
GRP="bitmap" && \
# audio language(s)
LNG="EN" && \
# subtitle languages
SUBS="EN" && \
# video bit rate
BV="10M" && \
# max vid bit rate
MRATE="20M" && \
# vid buffer size
BSIZE="40M" && \
# English audio stream index
ENAUD="0" && \
# English subtitle stream index
ENSUB="0" && \
# Additional mappings (use full -map [input]:[stream-type]:[index] syntax)
ADDMP="-map 0:a:1 -map 0:s:2" && \
ffmpeg -y -hide_banner -v quiet -stats \
-hwaccel qsv -hwaccel_output_format qsv -qsv_device /dev/dri/renderD129 \
-i "${MEDIA}" -pass 1 -map 0:v -c:v av1_qsv -preset slower -an -sn \
-b:v "${BV}" -maxrate:v "${MRATE}" -bufsize:v "${BSIZE}" \
-look_ahead 1 -look_ahead_depth 100 \
"${OUTPUT} [${QUALITY}-${RES} AV1 OPUS 2.0+5.1][${LNG][${SUBS}]-${GRP}.mkv" && \
ffmpeg -y -hide_banner \
-hwaccel qsv -hwaccel_output_format qsv -qsv_device /dev/dri/renderD129 \
-i "${MEDIA}" -pass 2 -map 0:v:0 \
-map 0:a:"${ENAUD}" -map 0:a:"${ENAUD}" -map 0:a:"${ENSUB}" \
"${ADDMP}" \
-c:v av1_qsv -preset slower -look_ahead 1 -look_ahead_depth 100 \
-b:v "${BV}" -maxrate:v "${MRATE}" -bufsize:v "${BSIZE}" \
-c:a libopus -ac:a:0 2 -b:a:0 192k -ac:a:1 6 -b:a:1 256k \
-filter:a:0 "pan=stereo|FL<FC+0.30*FL+0.30*BL|FR<FC+0.30*FR+0.30*BR" \
-c:s copy
-metadata title="${CLNTTL} | ${GRP}" \
-metadata:s:v:0 title='AV1 "${RES}" "${BV}" ABR' \
-metadata:s:a:0 title='English OPUS Stereo Dialog Mix' \
-metadata:s:a:1 title='English OPUS 5.1' \
-metadata:s:s:0 title='English' \
-metadata:s:s:1 title='English (SDH)' \
"${OUTPUT} [${QUALITY}-${RES} AV1 OPUS 2.0+5.1][${LNG][${SUBS}]-${GRP}.mkv" && \
rm ffmpeg2pass*
Still haven't figured out the best way to automate selection for a bunch of stuff. Beginning to reach my limits on bash scripting, partially because I'm just writing these to copy and paste into the shell. I'll probably throw together a Python script or two in the coming days to see if I can get anything working on that front with a bit more friendly UX and maybe some deeper exploration of files.
Jellyfin 10.10.0 LSIO Docker | Ubuntu 24.04 LTS | i7-13700K | Arc A380 6 GB | 64 GB RAM | 79 TB Storage