Log in

View Full Version : HEVC TV Show- Optimal Settings for 10Bit (~550MB)


dixierebel1929
13th August 2016, 05:05
Hello all,

I am currently attempting to convert my BluRay hard copy of Grimm (Seasons 1-4) to a digital copy, so that I can play it on other devices like my tablet, that don't have a BluRay disc drive. I physically OWN this media, and have not acquired it by illegal means, nor do I intend to SHARE it (illegally). I am more familiar with H.264 format and have already successfully "ripped" all 4 seasons. However, in H.264 format all 4 seasons take up over 250GB and is beyond the storage capacity of many of my devices. Which is why I wish to convert them into H.265(x265) format.

I have read through several forums on what the "optimal" settings are for achieving the best video Quality using a x265 Encoder/Transcoder. However, most of the threads I've read appear to discuss either optimal Film settings, Anime settings, or suggest the use of settings that result in 750MB+ file size(s). For example, here's what I get with a slightly modified version of "Littlepox's" "tune film" settings from Doom9's forum:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Complete name : Grimm.S01E01.1080p.10Bit.x265.mp4
Format : hvc1
Codec ID : hvc1 (iso4/hvc1/iso6)
File size : 795 MiB
Duration : 43 min
Overall bit rate mode : Variable
Overall bit rate : 2 569 kb/s
Writing application : Hybrid 2016.07.16.1

Video
ID : 1
Format : HEVC
Format/Info : High Efficiency Video Coding
Format profile : @L4.1@High
Codec ID : hvc1
Codec ID/Info : High Efficiency Video Coding
Duration : 43 min
Source duration : 43 min
Bit rate : 2 234 kb/s
Maximum bit rate : 13.5 Mb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:4:4
Bit depth : 10 bits
Bits/(Pixel*Frame) : 0.045
Stream size : 691 MiB (87%)
Source stream size : 724 MiB (91%)
Writing library : x265 2.0+4-43ca544799c2:[Windows][GCC 5.4.0][64 bit] 10bit
Encoding settings : wpp / ctu=64 / min-cu-size=8 / max-tu-size=32 / tu-intra-depth=1 / tu-inter-depth=1 / me=2 / subme=3 / merange=50 / no-rect / no-amp / max-merge=4 / temporal-mvp / no-early-skip / rskip / rdpenalty=2 / no-tskip / no-tskip-fast / strong-intra-smoothing / no-lossless / cu-lossless / no-constrained-intra / no-fast-intra / open-gop / no-temporal-layers / interlace=0 / keyint=300 / min-keyint=23 / scenecut=40 / rc-lookahead=40 / lookahead-slices=6 / bframes=6 / bframe-bias=0 / b-adapt=2 / ref=4 / limit-refs=3 / limit-modes / weightp / weightb / aq-mode=1 / qg-size=16 / aq-strength=1.00 / cbqpoffs=4 / crqpoffs=4 / rd=3 / psy-rd=1.85 / rdoq-level=2 / psy-rdoq=5.80 / no-rd-refine / signhide / deblock=-3:-3 / sao / no-sao-non-deblock / b-pyramid / cutree / no-intra-refresh / rc=crf / crf=24.0 / qcomp=0.60 / qpmin=0 / qpmax=51 / qpstep=4 / vbv-maxrate=50000 / vbv-bufsize=50000 / crf-max=0.0 / ipratio=1.10 / pbratio=1.10
Language : English
Color range : Limited
Matrix coefficients : BT.709

Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 43 min
Bit rate mode : Variable
Bit rate : 225 kb/s
Maximum bit rate : 245 kb/s
Channel(s) : 2 channels
Channel(s)_Original : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 kHz
Frame rate : 46.875 FPS (1024 spf)
Compression mode : Lossy
Stream size : 69.5 MiB (9%)
Title : AAC#audio:lang=en@GPAC0.6.2-DEV-rev667
Language : English
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
My goal is to shave approximately 200MB off the file size to around (550MB), while maintaining a (Video) Bitrate >1500 KB/s and a QP Value ~(22-22.5). I've achieved the above criteria, but, I've got no idea if I did it in the most efficient way possible..
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
General
Complete name : Grimm.S01E09.1080p.10Bit.X265.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : iso4 (iso4/hvc1/iso6)
File size : 540 MiB
Duration : 43 min
Overall bit rate mode : Variable
Overall bit rate : 1 736 kb/s
Writing application : Internet Friendly Media Encoder v6.1 (Pixelaphobia) 64bit

Video
ID : 1
Format : HEVC
Format/Info : High Efficiency Video Coding
Format profile : @L4.1@High
Codec ID : hvc1
Codec ID/Info : High Efficiency Video Coding
Duration : 43 min
Bit rate : 1 512 kb/s
Maximum bit rate : 10.0 Mb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 10 bits
Bits/(Pixel*Frame) : 0.030
Stream size : 469 MiB (87%)
Title : Video 1
Writing library : x265 1.9+3-548a45bbf223:[Windows][ICC 1600][64 bit] 10bit
Encoding settings : wpp / ctu=64 / min-cu-size=8 / max-tu-size=32 / tu-intra-depth=1 / tu-inter-depth=1 / me=1 / subme=2 / merange=57 / no-rect / no-amp / max-merge=2 / temporal-mvp / no-early-skip / rdpenalty=0 / no-tskip / no-tskip-fast / strong-intra-smoothing / no-lossless / no-cu-lossless / no-constrained-intra / no-fast-intra / open-gop / no-temporal-layers / interlace=0 / keyint=250 / min-keyint=23 / scenecut=40 / rc-lookahead=20 / lookahead-slices=6 / bframes=4 / bframe-bias=0 / b-adapt=2 / ref=3 / limit-refs=3 / no-limit-modes / weightp / no-weightb / aq-mode=1 / qg-size=32 / aq-strength=1.00 / cbqpoffs=6 / crqpoffs=6 / rd=3 / psy-rd=2.00 / rdoq-level=0 / psy-rdoq=0.00 / no-rd-refine / signhide / deblock / sao / no-sao-non-deblock / b-pyramid / cutree / no-intra-refresh / rc=crf / crf=23.4 / qcomp=0.60 / qpmin=0 / qpmax=51 / qpstep=4 / vbv-maxrate=50000 / vbv-bufsize=50000 / crf-max=0.0 / ipratio=1.40 / pbratio=1.30
Language : English

Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 43 min
Source duration : 43 min
Bit rate mode : Variable
Bit rate : 224 kb/s
Maximum bit rate : 245 kb/s
Channel(s) : 2 channels
Channel(s)_Original : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 kHz
Frame rate : 46.875 FPS (1024 spf)
Compression mode : Lossy
Stream size : 69.8 MiB (13%)
Source stream size : 69.8 MiB (13%)
Title : Audio 1
Language : English
Default : Yes
Alternate group : 1
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
It seems like I should be able to increase some things and decrease others, to improve the quality. I'm not as experienced with Video Encoding/Transcoding as some of you other guys, so Any advice on what I show raise/lower (or turn off) to help FURTHER improve the Quality would be MUCH appreciated!

dixierebel1929
24th August 2016, 12:33
After nearly 2 weeks of fine tuning, here's what I've come up with to produce the best results-

MediaInfo:
ctu=64 / min-cu-size=8 / max-tu-size=32 / tu-intra-depth=3 / tu-inter-depth=3 / me=3 / subme=5 / merange=50 / no-rect / no-amp / max-merge=4 / temporal-mvp / no-early-skip / rskip / rdpenalty=0 / no-tskip / no-tskip-fast / strong-intra-smoothing / no-lossless / no-cu-lossless / no-constrained-intra / no-fast-intra / no-open-gop / no-temporal-layers / interlace=0 / keyint=300 / min-keyint=24 / scenecut=40 / rc-lookahead=40 / lookahead-slices=1 / bframes=4 / bframe-bias=0 / b-adapt=2 / ref=3 / limit-refs=3 / limit-modes / weightp / weightb / aq-mode=2 / qg-size=16 / aq-strength=1.00 / cbqpoffs=0 / crqpoffs=0 / rd=6 / psy-rd=1.80 / rdoq-level=2 / psy-rdoq=4.80 / no-rd-refine / signhide / deblock=0:0 / sao / sao-non-deblock / b-pyramid / cutree / no-intra-refresh / rc=crf / crf=24.30 / qcomp=0.60 / qpmin=0 / qpmax=51 / qpstep=4 / vbv-maxrate=12000 / vbv-bufsize=12000 / crf-max=0.0 / ipratio=1.10 / pbratio=1.10

Command-Line:
x265 --input - --output-depth 10 --y4m --profile main10 --high-tier --level-idc 4.1 --qg-size 16 --tu-intra-depth 3 --tu-inter-depth 3 --me star --subme 5 --merange 50 --limit-modes --max-merge 4 --no-open-gop --keyint 300 --min-keyint 24 --weightb --b-intra --rc-lookahead 40 --lookahead-slices 1 --crf 24.30 --ipratio 1.1 --pbratio 1.1 --rd 6 --psy-rd 1.80 --rdoq-level 2 --psy-rdoq 4.80 --aq-mode 2 --vbv-maxrate 12000 --vbv-bufsize 12000 --sao-non-deblock --range limited --colormatrix bt709

Universal x265 Command-Line Version (For CTRL+Copy):
--qg-size 16 --tu-intra-depth 3 --tu-inter-depth 3 --me 3 --subme 5 --merange 50 --limit-modes --max-merge 4 --no-open-gop --keyint 300 --min-keyint 24 --weightb --b-intra --rc-lookahead 40 --lookahead-slices 1 --ipratio 1.1 --pbratio 1.1 --rd 6 --psy-rd 1.80 --rdoq-level 2 --psy-rdoq 4.80 --aq-mode 2 --vbv-maxrate 12000 --vbv-bufsize 12000 --sao-non-deblock --range limited


These x265 settings yield:

General
Complete name : Grimm.S03E01.The.Ungrateful.Dead.1080p.BluRay.x265.mp4
Format : hvc1
Codec ID : hvc1 (iso4/hvc1)
File size : 564 MiB
Duration : 46 min
Overall bit rate mode : Variable
Overall bit rate : 1 710 kb/s
Writing application : Hybrid 2016.07.16.1

Video
ID : 1
Format : HEVC
Format/Info : High Efficiency Video Coding
Format profile : Main 10@L4.1@High
Codec ID : hvc1
Codec ID/Info : High Efficiency Video Coding
Duration : 46 min
Source duration : 46 min
Bit rate : 1 409 kb/s
Maximum bit rate : 11.6 Mb/s
Width : 1 440 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Original display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 29.970 (30000/1001) FPS
Original frame rate : 29.970 (29970/1000) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 10 bits
Bits/(Pixel*Frame) : 0.030
Stream size : 465 MiB (82%)
Source stream size : 489 MiB (87%)
Writing library : x265 2.0+4-43ca544789c2:[Windows][GCC 5.4.0][64 bit] 10bit
Language : English
Color range : Limited
Matrix coefficients : BT.709

Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 45 min
Bit rate mode : Variable
Bit rate : 225 kb/s
Maximum bit rate : 236 kb/s
Channel(s) : 2 channels
Channel(s)_Original : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 kHz
Frame rate : 46.875 FPS (1024 spf)
Compression mode : Lossy
Stream size : 74.2 MiB (13%)
Title : AAC#audio:lang=en@GPAC0.6.2-DEV-rev667-g5eb5e94-ab-suite
Language : English
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

If you're converting a show that has less action scenes and you wish to increase quality even more (Higher CRF/Birate) or reduce file size further your best bet is to:

1. Increase "Quantization Group Size" from 16 to 32.
Command Line:
(--qg-size 16) to (--qg-size 32)
--qg-size 64 is the default x265 setting.

2. Decrease "Motion Estimation" from 3/star to 2/umh.
Command Line:
(--me 3) to (--me 2) with "Hybrid" Transcoder (--me star) to (--me umh)
--me 1 (--me hex) is the default x265 setting.

3. Decrease "Sub Motion Estimation" from 5 to 3.
Command Line:
(--subme 5) to (--subme 3)
--subme 2 is the default x265 setting.

Depending on the source file you're converting/transcoding you may also try to:

4. Decrease "Adaptive Quantization Mode" from Auto/2 to Normal/1.
Command Line:
(--aq-mode 2) to (--aq-mode 1)
--aq-mode 1 is the default x265 setting.

5. Decrease "Deblock" from 0:0 to -2:-2.
Command Line:
(--deblock=0:0) to (--deblock=-2:-2)
--deblock=0:0 is the default x265 setting.




P.S.- It took quite a bit of digging around to find this, but if you're having trouble with the buffering/load times of your x265 videos in VLC then your problem is "Open GOP". I HIGHLY recommend you disable this setting when transcoding if you use VLC for playback.

To disable Open GOP in Command-Line:
--no-open-gop

Furthermore, Media Player Classic (MPC) tends to work better with x265 video files that have Open GOP enabled.


Special Thanks to- littlepox, Benwaggoner, and tebasuna51

Selur
28th August 2016, 11:54
just out of curiosity: Why do you convert your 4:2:0 source to 4:4:4?

x265_Project
28th August 2016, 19:54
just out of curiosity: Why do you convert your 4:2:0 source to 4:4:4?
--profile main10 will encode HEVC with 4:2:0 chroma subsampling. To encode without chroma subsampling (4:4:4 chroma), you would need to use one of the 4:4:4 profiles; Main 4:4:4, or Main 4:4:4 10

Selur
29th August 2016, 05:42
@x265_Project: I know, but I don't get how your post is related to me asking why he converts 4:2:0 to 4:4:4,....

Jamaika
29th August 2016, 06:12
--profile main10 will encode HEVC with 4:2:0 chroma subsampling. To encode without chroma subsampling (4:4:4 chroma), you would need to use one of the 4:4:4 profiles; Main 4:4:4, or Main 4:4:4 10
And here is another problem arises. If you have an older computer and plan to split file into any number of parts and then merge them, understand that all parts must have the same parameters. Differently than for H264.
Decoder in one container doesn't distinguish between ex. Main 4: 4: 4 or Main 4: 4: 4 10. Sees only the parameters of the first part.

dixierebel1929
18th November 2016, 18:49
Sorry, I meant to reply back to this a while go. Yes, at the time I didn't realize that most 1080p Blu-Ray content is encoded with 420 Chroma Sampling.

I will see about getting the title of the thread changed so that the wrong Chroma Sampling (4:4:4) doesnt continue to be the topic of discussion here.

So, assuming the optimal Chroma sampling is 4:2:0, let us discuss the optimal x265 encoder settings for transcoding a TV Show to:

1.) 10Bit
2.) I420
3.) File size of ~550MB
4.) Bitrate of ~1400-1700 Kbps

For example, if I have a H.264 TV Show episode that I encoded using the below parameters, and I wish to transcode it to H.265 achieving the highest possible QP(or numerically Lowest):

cabac=1 / ref=4 / deblock=1:-1:-1 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=34 / lookahead_threads=5 / sliced_threads=0 / nr=150 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=8 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=24 / scenecut=0 / intra_refresh=0 / rc_lookahead=120 / rc=crf / mbtree=1 / crf=18.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=15000 / vbv_bufsize=31250 / crf_max=0.0 / nal_hrd=vbr / filler=0 / ip_ratio=1.40 / aq=3:1.00

benwaggoner
21st November 2016, 22:08
Sorry, I meant to reply back to this a while go. Yes, at the time I didn't realize that most 1080p Blu-Ray content is encoded with 420 Chroma Sampling.

I will see about getting the title of the thread changed so that the wrong Chroma Sampling (4:4:4) doesnt continue to be the topic of discussion here.
I fixed the title for you.

Also, ALL Blu-ray content uses 4:2:0 chroma subsampling. All digital video delivered to consumers using a MPEG codec has always been 4:2:0, even interlaced. It's been a 4:2:0 world since VideoCD.

The main point of 4:2:2 is for interlaced source in production so that chroma samples don't have to cross fields. The main point of 4:4:4 is to not be using YUV at all in film production.

MeteorRain
21st November 2016, 23:14
Also file size converts with bitrate as size = bitrate * duration so you specify either bitrate or size.
And because bitrate varies between episodes and content, you'll have to decide whether consistent quality or consistent size is your primary concern.

sephirotic
18th December 2016, 04:17
"Best settings" for what? Film?

There is no such thing as absolutely "best settings".
Yes, we can try and categorize large patterns of different types of source, such as Heavy Grain 16mm source (like Walking Dead), or moderate 35mm grain film like most modern hollywood movies, As well as digital flat animation, old school 16mm cell animation, Modern digital almost grain-free 4k series like Amazon Grand tour (although some scenes have fake grain in it which idealy should be zoned and treated differently), etc etc etc.

And even if you focus on modern 35mm hollywood films which have moderate fine grain (the kind of source that most people want the "FILM tune" to focus on) you should also consider the overall quality and bitrate to see if it is worth try to keep the grain and the film tune. TV Shows are not what the "FILM Tune" should be focused on and different TV shows are filmed differently. Many modern shows are digital, but some still use 35mm, the Walking Dead example is a notable exception that actually goes with heavy grain for an aesthetic choice.

Anyway, CRF 20 is not enough for proper grain retention with that FILM tune settings, 24 even worse. At that level of bitrate (2500~5000) for a full 1.77 1080p source with even moderate action, you might as well forget completely about trying to keep the grain and prefilter the grain out with some Avisynth script, preferably SMDegrain. A degrained source will be more adequate for a lower bitrate or CRF setting and will need different tune settings for a better overall look. I'd never go with -3 deblock at such low bitrates, not even close with that, I'd go positive, around 2, maybe 1. I'd use -3 only with very high CRF settings like 15 or 16, although at that point I'd still defintely prefer to stick with x264. Subme is also very low. Not much point in increasing it with a grainy source, indeed, but again, at that level of quality I'd degrain the source and the flatter area would benefit from a higher SUBME like 4 or even 5. Psy also seems too high, I'd need to experience with that.

And since you should probably degrain anyway if you want such low filesize per episode, (most people are not wiling to accept the high bitrate needed to keep a nice fine grain and high quality encode or nor even notice the loss in quality at all) you might as well go to 720p instead of having a bitstarved 1080p file, specially because degrainers inevitably remove some fine detail, so not much point in keeping with 720p resolution. In fact, from the tests I did in the past with Star Wars TFA around 2500kbps (CRF 20 and 24) A 720p x264 encode with the same bitrate of the resulting Grain-tuned HEVC file looked much better than the latter, and even better if it was degrained.

I have been testing 3 different samples and tunes with HEVC comparing with x264 in the last couple of months. I've tested some tune suggestions form moderate grain as well as flat animation and I'm trying to see what works best for me, but I'm waiting for version 2.2 before trying to work again with the 35mm grain footage I've separated to test with.

Also, needless to say that there is no point in encoding in 10 bit if you don't use the high bit depth mode in SMDegrain or apply a deband filter, you should stick with 8 bit for better compatibility. Same goes for the 4:4:4 no point in upscaling the Chroma.