2023-08-23, 08:12 PM
I wanted to get this started and I'll throw in some of my basic code that I've been using for AV1 encodes recently, both with ffmpeg as well as ab-av1, which I've grown to really like. I don't have a lot of time to spare at the moment, but want to welcome anybody who wants to contribute with questions they have, suggestions to revise code that's posted, programs/scripts to use, better routes to go, guides they've utilized in the past, or even struggles they're having.
This is an open topic that I don't think fits anywhere else but is something we all work with and around. Open discussion is welcome, but please keep it friendly and constructive as well as within forum rules. Maybe replace your file names with Big Buck Bunny or something like that. ;-)
Here's a sample ffmpeg bash for loop I used to encode a season (could easily be adapted using find to do an entire folder or drive):
This is designed to grab only English-language streams, encode using the SVT-AV1 encoder with some params I've since found aren't particularly necessary (input-depth may not be required) as well as the "midnight" downmixing for better dialog mix in stereo audio. This provided a VMAF score of about 94.5% which was reasonable, but not amazing and you could definitely tell. I used it on a series that was low-risk for me and this was part of my experimentation. I have since refined, but this is a good, clean look at what a fairly simple (yet complex) ffmpeg command can look like.
Here's a similar ab-av1 command:
You'll see some similarities. Notice film-grain has changed, HDR is enabled, input-depth is gone, and the preset has been lowered. This is a 4K source and I went a lot more granular and did testing to ensure I could get a VMAF of at least 95%. I tried for 96% and that would've taken three days per episode on CPU. I haven't gotten QSV working with either my CPU or my A380 yet, so if anybody has experience there, I'd appreciate a boost.
Also looking for any advanced tuning that folks suggest...I haven't touched my anime as of yet because I'm a little scared and most of my sources aren't remux quality, but I do have the ability to rip some remuxes and re-encode them, which I would like to do if I can tune a profile well enough to get good AV1 encodes. From what I understand, folks use some pretty complex software with crazy profiles to improve upon the BD rips they get, though. Not sure I'm at that level...
So please, share, ask questions, start the discussion!
This is an open topic that I don't think fits anywhere else but is something we all work with and around. Open discussion is welcome, but please keep it friendly and constructive as well as within forum rules. Maybe replace your file names with Big Buck Bunny or something like that. ;-)
Here's a sample ffmpeg bash for loop I used to encode a season (could easily be adapted using find to do an entire folder or drive):
Code:
for i in *.mkv; do \
ffmpeg -i "${i}" \
-map 0:v -map 0:m:language:eng \
-c:v libsvtav1 \
-svtav1-params "preset=5:crf=27:film-grain=2:input-depth=10:tune=0" \
-pix_fmt yuv420p10le \
-c:a libopus -ac 2 -b:a 160k \
-af "pan=stereo|FL<FC+0.30*FL+0.30*BL|FR<FC+0.30*FR+0.30*BR"
-c:s copy \
"${i%.mkv} [AV1 10bit OPUS 2.0][EN][EN]-rgName.mkv"; done
This is designed to grab only English-language streams, encode using the SVT-AV1 encoder with some params I've since found aren't particularly necessary (input-depth may not be required) as well as the "midnight" downmixing for better dialog mix in stereo audio. This provided a VMAF score of about 94.5% which was reasonable, but not amazing and you could definitely tell. I used it on a series that was low-risk for me and this was part of my experimentation. I have since refined, but this is a good, clean look at what a fairly simple (yet complex) ffmpeg command can look like.
Here's a similar ab-av1 command:
Code:
for i in *.mkv; do \
ab-av1 auto-encode \
--encoder libsvtav1 --enc map=0:v --enc map=0:m:language:eng --preset 4 \
--pix-format yuv420p10le \
--svt enable-hdr=1 --svt tune=0 --svt film-grain=10 \
--acodec libopus --downmix-to-stereo --enc b:a=160k \
--enc af="pan=stereo|FL<FC+0.30*FL+0.30*BL|FR<FC+0.30*FR+0.30*BR" \
-i "${i}" -o "${i%.mkv} [WEBDL-2160p AV1 HDR10Plus 10bit OPUS 2.0][EN][EN]-rgName.mkv"; done
You'll see some similarities. Notice film-grain has changed, HDR is enabled, input-depth is gone, and the preset has been lowered. This is a 4K source and I went a lot more granular and did testing to ensure I could get a VMAF of at least 95%. I tried for 96% and that would've taken three days per episode on CPU. I haven't gotten QSV working with either my CPU or my A380 yet, so if anybody has experience there, I'd appreciate a boost.
Also looking for any advanced tuning that folks suggest...I haven't touched my anime as of yet because I'm a little scared and most of my sources aren't remux quality, but I do have the ability to rip some remuxes and re-encode them, which I would like to do if I can tune a profile well enough to get good AV1 encodes. From what I understand, folks use some pretty complex software with crazy profiles to improve upon the BD rips they get, though. Not sure I'm at that level...
So please, share, ask questions, start the discussion!
Jellyfin 10.10.0 LSIO Docker | Ubuntu 24.04 LTS | i7-13700K | Arc A380 6 GB | 64 GB RAM | 79 TB Storage