Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.


Go Back   Doom9's Forum > Video Encoding > High Efficiency Video Coding (HEVC)

Thread Tools Search this Thread Display Modes
Old 22nd February 2022, 19:29   #1  |  Link
Registered User
Join Date: Nov 2019
Posts: 18
Optimizing ffmpeg x265 for UHD collection

I've historically backed up my entire UHD Blu-ray collection to my NAS as full AVCHD backups (via MakeMKV) that I play on my Oppo 203, but I recently have gotten into using Plex and would like to encode my whole collection for playback via Infuse (via Plex) on my Apple TV 4K Gen 2.

I wanted to do a sanity check on my workflow and ffmpeg x265 settings before I'm too far down the rabbit hole.

My biggest area of concern (given that it's the most time consuming) is optimization of my compression settings. I've decided to encode the majority of my UHD collection with the Slow preset between CRF 16-18. With that said, I'll end up encoding some of my favorite films with Slower and some of the stuff I'm not sure that I'll ever watch again on Medium (up to CRF 20).

Given that, I'd like to keep a list of optimal settings for certain types of files:
  • No-grain films
  • Low-grain films
  • Medium-grain films
  • High-grain films
  • Low luminance films
  • Anime with grain
  • Anime without grain
  • Hand-drawn animation
  • CG animation
  • Anything else I'm not thinking of...

The only advanced options I've set that stray from encoder defaults are:
deblock=-1,-1 / selective-sao=2
...but I'm honestly not sure if these are optimal in most cases or how to test given the hundreds of UHD discs I'll be encoding.

I don't know enough about x265 to produce a list of optimal settings for each of these given my goals. With that said, my goals are to optimize quality over storage enough that streaming over the internet isn't difficult when I'm on a good internet connection.

As an aside, here's my workflow currently:
  1. Backup movie to NAS as AVCHD folder with MakeMKV (already done)
  2. Create uncompressed "Original" MKV file with DoVi Profile 7 video, lossless audio, and all English subtitles.
  3. Encode with video ffmpeg x265 10-bit passing through HDR metadata
  4. Encode lossless 7.1 audio formats to EAC3 7.1 with Plex's EasyAudioEncoder or encode lossless 5.1 audio formats to AAC 5.1 with QAAC TVBR 127.
  5. If DoVi, strip DoVi RPU from original MKV and interleave RPU back into compressed HEVC video with dovi_tool as Profile 8.1
  6. Remux compressed video, compressed audio, and English subtitles labeled as Subtitles, SDH, and Translations with the
  7. I also strip any commentary/duplicate subtitles while remuxing and set my optimal MKV flags for everything. 'Default = off' for all subtitles, 'hearing impaired = on' for SDH, and 'forced = on' for Translations). I also set 'original = on' for everything that's in the original language.
  8. Side note, I have a slightly different workflow for foreign films to ensure I capture the additional audio and occasionally multiple subtitle formats (dubtitles, original language subtitles, SDH, forced translations, etc).

Any advice/recommendations are appreciated. Thank you!

Last edited by speedy; 26th February 2022 at 18:19.
speedy is offline   Reply With Quote
Old 26th February 2022, 23:27   #2  |  Link
Registered User
Join Date: May 2009
Posts: 299
Personally I would recommend you get rid of your Apple POS and move to a Shield as it's far more user friendly in regards to playing your own content. Apple devices are great if you want to stay in their ecosystem, not so great if you actually want to use the hardware outside of it.
RanmaCanada is offline   Reply With Quote
Old 1st March 2022, 18:37   #3  |  Link
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,309
This is all HDR? HDR and SDR need a variety of different parameters.

At CRF 16-18 most things should look pretty good, so it's more a matter of tuning for encoding speed and file size.

deblock=-1,-1 is much less needed in x265 than x264.
--ctu 32 is a good default for live action
--hdr10-opt is pretty essential for HDR-10 encoding
The more grain, the higher --psy-rd, --psy-rdoq, --nr-intra and --nr-inter values you'll want to use. --rd 4 can outperform --rd 6 with high grain as well.

--rskip 2 is better than the default mode.

For animation, I like to use --tskip, --tskip-fast, --tu-intra-depth 4, --tu-inter-depth 4

--csv-log-level 2 can be great for advanced users in diagnosing quality issues.

Do NOT use --tune grain, which is horribly old and terrible.

Assuming you are doing SDR and HDR across 8 genres, that's 16 different parameter sets. If you want more than just general advice, you should do some test runs, then share your command lines and more specific questions.

I have no idea what counts as a "low luminance film" - can you give an example?
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 13:28.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2022, vBulletin Solutions Inc.