justdan96 / tsMuxer

tsMuxer is a transport stream muxer for remuxing/muxing elementary streams, EVO/VOB/MPG, MKV/MKA, MP4/MOV, TS, M2TS to TS to M2TS. Supported video codecs H.264/AVC, H.265/HEVC, VC-1, MPEG2. Supported audio codecs AAC, AC3 / E-AC3(DD+), DTS/ DTS-HD.
Apache License 2.0
853 stars 144 forks source link

Muxed UHD HDR stream is darker than original #377

Open petef19 opened 3 years ago

petef19 commented 3 years ago

Hello,

I posted this on the makemkv forums and tagged your username, but did not get a response.

I remuxed the new LOTR UHD DV to m2ts file (and also a BDMV folder) via latest tsmuxer w64-nightly-2020-11-17--01-21-46 (did a 3 mins trim of disc 1), and the resulting m2ts file is slightly less bright in the highlights than the original UHD disc (same goes for the m2ts in the BDMV folder mux).

Both versions (orig | mux) were played back on Oppo 203 ( set to tv-led, full DV) connected to LG CX.

I only selected main video track (BL + EL), HD audio, and pgs. The muxed trim plays just fine, and triggers DV on the LG CX, but when picture comparing, the muxed version is less bright in the highlights.

see here for a screenshot comparison: https://screenshotcomparison.com/comparison/8739

(ignore the blown out highlights, this is a camera setting issue)

Any idea what could be causing this ?

Or lmk please if you want me to test anything.

jcdr428 commented 3 years ago

Hello @petef19, is this also the case for this frame (muxed less bright than original) if you remux the whole of the movie ?

petef19 commented 3 years ago

@jcdr428

I just remuxed the entire movie (LOTR UHD HDR Disc 1), once from the playlist and once directly from the main m2ts file.

Both of the full movie remuxes match the brightness of the original movie in full tv-led DV.

so it seems the trim introduced the change in brightness, and just to note the brightness change was throughout the entire 3 mins trim, as I tested 5 different scenes...

is that to be expected ?

Thx

jcdr428 commented 3 years ago

@petef19 I was expecting this. Each sequence in the stream contains the HDR10 max & min "Display Mastering Luminance" info (and the max "Content Light Level" and "Frame Average Light Level" info for HDR10+), which can vary along the movie. When you mux the whole movie, those max and min are calculated on all sequences. When you mux only a small part, those max and min are calculated on this part only. The only way to solve this would be for tsMuxer to scan the whole stream before muxing, but this is not the way tsMuxer has been developed... It would be quite a lengthy work to modify the behavior.

petef19 commented 3 years ago

The only way to solve this would be for tsMuxer to scan the whole stream before muxing, but this is not the way tsMuxer has been developed... It would be quite a lengthy work to modify the behavior.

no worries, this was just a test, and good to know that for trims of HDR content this will be affected

When you mux the whole movie, those max and min are calculated on all sequences.

why do you re-calculate the max/min when the entire movie is muxed ? can you not just copy the original values ?

Thanks.

jcdr428 commented 3 years ago

The values are extracted from the raw stream, so that it is independent of the container. Indeed, tsMuxer could first check whether the format is Blu-ray, and if there are already HDR info values in the mpls.

petef19 commented 3 years ago

Indeed, tsMuxer could first check whether the format is Blu-ray, and if there are already HDR info values in the mpls.

yeah agreed, if output is BDMV folder (and no trim/split/cut), then the original data should be untouched as much as possible