Log in

View Full Version : How to re-encode HDR video for classic lcd screen ?


burnix
11th June 2023, 09:25
Hi.

a friend of me give me a video of his wedding in hdr or hdr10 format. Colors are awfull on a "classic" lcd screen.

Do you have ffmpeg command line sample to encode it in "normal colors" format ????

Thanks

P.S : belgians are truly a special people

microchip8
11th June 2023, 12:43
We don't provide support for downloaded/pirated content!

RanmaCanada
11th June 2023, 22:49
You can use fastflix to tone map it, but understand that tone mapping isn't 100% accurate and can vastly change the end results pending on the template used.

FranceBB
14th June 2023, 21:18
Do you have ffmpeg command line sample to encode it in "normal colors" format?

I'm gonna reply only because now that we're back on Google, someone might search this topic and be disappointed, given that you edited your post...

Although I personally don't do those things in FFMpeg but rather in Avisynth, you can always apply a LUT before re-encoding:

https://forum.doom9.org/showthread.php?t=176091


or you can apply tonemapping with Reinhard (in a similar way on what we do in Avisynth with HDRTools by JPSDR) to go back to BT709, scale back to FULL HD from UHD and re-encode to H.264 + AAC.

In this second case, to go from HDR10 (which is BT2020 PQ UHD 10bit) to BT709 FULL HD 8bit you can do something like this:

ffmpeg -i "your_input.m2ts" -map 0:v -map 0:a -c:v libx264 -c:a aac -b:a 384k -profile:v high -level:v 4.1 -refs 4 -crf 18 -ignore_chapters 1 -ignore_unknown -write_tmcd 0 -movflags faststart -vf "sidedata=delete,metadata=delete,scale=w=1920:h=1080:flags=lanczos:sws_dither=ed,zscale=tin=smpte2084:min=bt2020nc:pin=bt2020:rin=tv:t=smpte2084:m=bt2020nc:p=bt2020:r=tv,zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=reinhard:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p10,scale=sws_dither=x_dither,format=yuv420p,setfield=prog,setdar=16/9,setsar=1" -x264opts "force_cfr=1:deblock=-1,-1:aud=1:overscan=show:colorprim=bt709:fullrange=off:transfer=bt709:colormatrix=bt709" -color_primaries bt709 -color_trc bt709 -colorspace bt709 -color_range tv -field_order progressive -brand mp42 -max_muxing_queue_size 700 -map_metadata -1 -metadata creation_time=now -an -f mp4 -y "output.mp4"



P.S : belgians are truly a special people

microchip8 isn't wrong. Most of us are working for different broadcasters or streaming services or authoring companies scattered all over the globe, so we don't really help people who are watching pirated contents 'cause it directly hurts our business and puts our jobs at risk on top of it being illegal. And just so you know:



a video of his wedding in hdr10 format.


this isn't convincing either, 'cause only some Samsung smartphones are recording directly in PQ (badly) and every professional camera shoots either Log (and then they go to PQ in post production) or HLG (or indeed the good old BT709 SDR).
So... before you say that they shot a wedding in PQ... well... think twice... 'cause they didn't, I mean, c'mon, not really...
Seriously, next time use something more realistic...