This is a place to store various little tidbits, info and code around video transcoding.
## Handbrake Levels
### 4K (HEVC)
- RF18 = Transparent
- RF19 = +66%
- RF20 = Netflix
### HD (HEVC)
- RF20 = Transparent
- RF21 = +66%
- RF22 = Netflix
- RF25 = HDR10 RF20
### HD (H264)
- RF17 = Transparent
- RF18 = +66%
- RF19 = Netflix
## Encoder Settings
### 4K
```
hdr-opt=1:repeat-headers=1:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc:high-tier=1:rect=0:sao=0:deblock=-3,-3:psy-rdoq=1.00:aq-mode=3
```
### HD
```
rect=0:sao=0:deblock=-3,-3:psy-rdoq=1.00:aq-mode=3
```
## Vs.
### HEVC vs. Apple Hardware Encoder – Quality Settings
- **4K**
- RF 20 = CQ 72
- **HD**
- RF 24 = CQ 15
## Transcode History
- **2021-03-20: Atmos**
- This is a tough one, but I'm considering passing thru the Atmos audio track for some 4K content going forward.
- Reasons? It's lossless, obviously. So no fear of losing data during downmixing to 5.1 E-AC-3. And for the most part I don't know what the future holds. Right now, I feel the chances of me ever getting a surround setup bigger than 5.1 to be extremely unlikely. And the changes of me getting height/ceiling speakers? Even slimmer. However, with things like upward firing speakers (meant to be crap BTW) and Dolby's Atmos Height Virtualization technology maybe utalising Atmos in the future will be easier. And the thing is, transcoding 4K content takes such a long time that I can't just knock out a quick re-transcode like I could with 1080p and H.264. So every 4K encode needs to be done right the first time around. So maybe it's time to start using Atmos sometimes.
- For movies that aren't great, or are unlikely to utalise Atmos (things like dramas) I'm going to continue with 5.1 E-AC-3. But for movies/TV I really like I'm going to start passing thru the Atmos audio.
- This would be a much easier decision (a no brainer in fact) if Atmos tracks were smaller, or could be easily transcoded by hobbyists. Because they are sadly usually encoded somewhere between 3.5 Mbps and 5.5 Mbps. Massive! I have loads of movies (especially HEVC ones) whose video bitrates are smaller than that! You can transcode Atmos. But you need special tools sadly. I'm not Netflix :(
- **2019-03-18: Switched from AC3 to E-AC3 (DD+)**
- Decided from now on to go with 5.1 E-AC3 (Dolby Digital+) instead of 5.1 AC3. Because:
- It’s what the streaming industry is now using (if your device doesn’t support E-AC3 Netflix won’t even offer you 5.1).
- Figured out why the Nvidia Shield wasn’t playing E-AC3. Optical cable can’t carry E-AC3. So I’ve plugged in the Shield’s HDMI cable directly into the soundbar and now it plays fine.
- Apparently the quality is far superior at the same bitrate. Netflix encoded 5.1 as low as 192 Kbps for a long time (they have increased it slightly though with the release of Stranger Things 3).
- **2019-03-18: Moved to vanilla Handbrake**
- **2019-02-21: Might switch to vanilla Handbrake**
- After years of trying to work out the best way or tool that will determine how much bitrate a movie encode will need I’ve realised I’ve been ignoring the simplest solution: Handbrakes built-in ‘Constant Quality’ feature! I mean I’m already essentially using Handbrake for all my encodes anyway, as video-transcode is just a tool that manipulates Handbrakes settings and uses ABR rather than Constant Quality. But CQ seems like it might be the answer. I’ve done a few tests of movies that I also know the Netflix bitrate of and it seems to roughly correlate. With “Arrival” needing little bitrate, and “Sex and the City 2” a lot. Now I need to experiment with what CQ number to go with. With “Arrival” CQ18 gave a bitrate of 2838 vs. Netflix’s 1780. But CQ18 on “Sex and the City 2” gave a bitrate of 21700 which is more than the original Blu-Ray (17464)! I’ll do a few more encodes at CQ18 to see. But I think I’ll reserve it for movies I really love. And use CQ19 for most movies. And CQ20 for movies I’m not that fussed about. Anyway, I think going forward I’ll do most encodes with Constant Quality, and use transcode-video ABR for when I already have a bitrate figure from Netflix, or if I want to limit the final file size (for crappy movies, for example).
- **2018-12-19: Switched to stereo, with EAC3 surround**
- Going to experiment with having the main audio track as stereo for a while. My thinking is that aside from the lounge (with its let’s be honest not great surround sound) all over devices are stereo only. And whilst Plex will transcode an surround to stereo without issue firstly it means that file is no longer being ‘direct played’, which may cause issues and slowness, and it’s taking a lossy AC3 and downmixing it to lossy AAC on the fly, which isn’t ideal for audio quality. Finally I’m going to include a secondary E-AC3 surround track at 384 Kbps for movies. So that in the following years if I get a surround sound system I can switch to that secondary audio track for decent surround sound. And since it’s encoded in E-AC3, 384 Kbps should be enough bitrate.
- **Netflix x264 vs. x265 vs. AV1**
- [https://www.youtube.com/watch?v=wi1BefrfTos](https://www.youtube.com/watch?v=wi1BefrfTos)
- **Deadpool 2: x264 vs. x265**
- My Transcode x264: 11Mbps
- Tigole QXR x265: 4.8Mbps
- Notes: After looking at the screenshots it seems that Tigole x265 isn't as high a quality as my x264 transcode. I guess this makes sense as it's 43% the size of mine and I've found that x265 needs be closer 55-60% the bitrate of x264 to achieve transparency. But I thought that the torrent group may have some tricks it used or something. Still, the differences are *very* minor (only really noticeable in action scenes) and it’s a perfectly acceptable picture quality, just not transparent. I’m sure giving it slightly more bitrate would make it transparent. I guess the only way of telling if they do do any tricks is doing my own x265 transcode at the same bitrate and seeing the difference.