[FFmpeg-user] UHD-HDR10 to HD... stunning, and it's really tiny!
Mark Filipak
markfilipak.imdb at gmail.com
Fri May 16 02:56:39 EEST 2025
I've learned so much here that I want to give back something wonderful. But first, about my recent
thread: "Is libplacebo only for GPUs?", if you gurus see better methods than I'm using here, feel
free to make suggestions, eh?
With the following Windows script, I turned an Ultra Blu-ray movie into a perfect HD mp4 -- 55.5 GB
to 3.2 GB -- incredible resolution, color -- a 2 hour 36 minute, 1920x1080 that's so compressed, you
could put two of them on a DVD!
set _UHD_SOURCE_=h:\HDMV\STREAM\00600.m2ts
set _HD_TARGET_=c:\THE REVENANT [2015].mp4
set _UHD_TO_HD_=scale=w=iw/2:h=ih/2
set _TO_LINEAR_=zscale=transfer=linear:npl=100,format=gbrpf32le
set _TONEMAP_=tonemap=tonemap=hable:desat=0
set _TO_BT709_=zscale=primaries=bt709:transfer=bt709:matrix=bt709:range=tv
set _BT2020HDR10_TO_BT709_=%_TO_LINEAR_%,%_TONEMAP_%,%_TO_BT709_%
set _TWEAK_=eq=contrast=1.28:brightness=0.0725
ffmpeg^
-i "%_UHD_SOURCE_%"^
-an -dn -sn^
-filter_complex^
"[0:v]%_UHD_TO_HD_%,%_BT2020HDR10_TO_BT709_%,%_TWEAK_%,format=yuv420p[v]"^
-map "[v]"^
-c:v libx264 -x264-params 8x8dct=1:analyse=0x3,0x133:aq-mode=1:aq-strength=1.0^
:b-adapt=2:b-bias=0:b-pyramid=2:bframes=5:bitrate=2850:bluray-compat=0:cabac=1:chroma-me=1^
:chroma-qp-offset=-2:constrained-intra=0:cplxblur=20.0:cqm=flat:deadzone-inter=21^
:deadzone-intra=11:deblock=1,-1,-1:direct=auto:fast-pskip=0:filler=0:interlaced=0^
:intra-refresh=0:ipratio=1.40:keyint-min=23:keyint=240:lookahead-threads=3:mbtree=1^
:me=umh:merange=30:nal-hrd=none:nr=0:open-gop=0:psy-rd=1.00,0.00:psy=1:qblur=0.5^
:qcomp=0.60:qpmax=69:qpmin=1:qpstep=4:ratetol=1.0:rc-lookahead=50:ref=5:scenecut=40^
:sliced-threads=0:slices=4:subme=7:threads=12:trellis=1:vbv-bufsize=78125^
:vbv-maxrate=62500:weightb=1:weightp=2^
"%_HD_TARGET_%"
There's a small tone mapping _TWEAK_, unnoticeable unless source-target switching.
Does the order of operations make any difference? I experimented. Instead of
Method A) _TO_LINEAR_ _TONEMAP_ _TO_BT709_ _TWEAK_,
I tried
Method B) _TO_LINEAR_ _TWEAK_ _TONEMAP_ _TO_BT709_.
The result was much darker. So, I'm guessing that
1) 'contrast=1.28' is multiplicative,
2) 'brightness=0.0725' is additive,
3) BT709 is non-linear, and that
4) tweaking should be done while the palette is linear, i.e. Method B.
More information about the ffmpeg-user
mailing list