LINUX - ffmpeg - 4K HDR HEVC X265 - Plex

MKV playback, recompression, remuxing, codec packs, players, howtos, etc.
Post Reply
plittlefield
Posts: 37
Joined: Wed May 10, 2017 11:04 am

LINUX - ffmpeg - 4K HDR HEVC X265 - Plex

Post by plittlefield » Tue Apr 16, 2019 1:16 pm

Hello All,

As I have benefited so much from MakeMKV and learned so much from this forum, I thought I would post my notes on creating 4K HDR movie files for Plex.

This is still a "work in progress" but believe I have the correct format of MKV for my Samsung TV so that I can experience 4K HDR from my Plex Media Server.

Here is the important hardware:-

* ASUS BW-16D1HT with v3.01 firmware and LibreDrive (4K UHD Friendly - thanks to user asmcom :-)
* Samsung UE49KU6400 49" 4K Ultra HD Smart HDR LED TV
* Roku Streaming Stick+

Here is the important software:-
* MakeMKV
* Ffmpeg
* X265

Here is the possible winning command line:-

Code: Select all

ffmpeg -y -i "massive_4k_input_file.mkv" -t 00:10:00 -analyzeduration 100M -probesize 100M -max_muxing_queue_size 9999 -map 0:v:0 -map 0:a:1 -pix_fmt yuv420p10le -vcodec libx265 -preset medium -x265-params "keyint=60:bframes=3:vbv-bufsize=75000:vbv-maxrate=75000:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc:master-display='G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,500)'" -acodec ac3 -ab 384k -ac 6 -map_metadata -1 -metadata title="Movie Name (2018)" -metadata:s:a:0 language=eng -map_chapters -1 -sn "Movie Name (2018) 4K ffmpeg.mkv"
Here is the mediainfo output on the file:-

Code: Select all

Format                                   : Matroska
Format version                           : Version 4
File size                                : 213 MiB
Duration                                 : 10 min 0 s
Overall bit rate                         : 2 973 kb/s
Writing application                      : Lavf58.27.100
Writing library                          : Lavf58.27.100
ErrorDetectionType                       : Per level 1

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Commercial name                          : HDR10
Format profile                           : Main 10@L5@High
Codec ID                                 : V_MPEGH/ISO/HEVC
Duration                                 : 10 min 0 s
Bit rate                                 : 2 530 kb/s
Width                                    : 3 840 pixels
Height                                   : 2 160 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Original frame rate                      : 23.976 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 10 bits
Stream size                              : 181 MiB (85%)
Writing library                          : x265 3.0+28-gbc05b8a:[Linux][GCC 5.4.0][64 bit] 10bit
Encoding settings                        : cpuid=1064959 / frame-threads=2 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=3840x2160 / interlace=0 / total-frames=0 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=4 / no-allow-non-conformance / repeat-headers / annexb / no-aud / no-hrd / info / hash=0 / no-temporal-layers / open-gop / min-keyint=6 / keyint=60 / gop-lookahead=0 / bframes=3 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=25 / lookahead-slices=4 / scenecut=40 / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=2 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=3 / limit-refs=3 / limit-modes / me=3 / subme=3 / merange=57 / temporal-mvp / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=4 / no-early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=1.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=26.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / vbv-maxrate=75000 / vbv-bufsize=75000 / vbv-init=0.9 / crf-max=0.0 / crf-min=0.0 / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=9 / transfer=16 / colormatrix=9 / chromaloc=0 / display-window=0 / master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,500) / max-cll=0,0 / min-luma=0 / max-luma=1023 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / no-opt-cu-delta-qp / no-aq-motion / hdr / no-hdr-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=5 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=0 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / qp-adaptation-range=1.00
Default                                  : Yes
Forced                                   : No
Color range                              : Limited
Color primaries                          : BT.2020
Transfer characteristics                 : PQ
Matrix coefficients                      : BT.2020 non-constant
Mastering display color primaries        : Display P3
Mastering display luminance              : min: 0.0500 cd/m2, max: 1000 cd/m2

Audio
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : A_AC3
Duration                                 : 10 min 0 s
Bit rate mode                            : Constant
Bit rate                                 : 384 kb/s
Channel(s)                               : 6 channels
Channel layout                           : L R C LFE Ls Rs
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 27.5 MiB (13%)
Writing library                          : Lavc58.48.101 ac3
Language                                 : English
Service kind                             : Complete Main
Default                                  : Yes
Forced                                   : No
As you can see, I have only gone for AC3 audio for the time being, because I was more concerned about the picture being correct...

...and as far as I can tell (because I do not have a standalone consumer UHD player) the resulting picture is very nice indeed.

I needed a budget 4K HDR media player and I am very impressed with the Roku, in fact I still cannot believe it's able to stream 4K over wireless with DIRECT PLAY in Plex!

So, I welcome people comments on this, but wanted to thank the developers of MakeMKV, everyone on this forum and especially to the ebay user who sold me the correct drive and has excellent customer service... above and beyond the call of duty.

:-)

Regards,

Paully

Post Reply