kingslay / KSPlayer

A video player for iOS、macOS、tvOS、visionOS , based on AVPlayer and FFmpeg, support the horizontal, vertical screen. support adjust volume, brightness and seek by slide, SwiftUI, support subtitles.
https://apps.apple.com/app/tracyplayer/id6450770064
GNU General Public License v3.0
984 stars 197 forks source link

Dynamic Range (DV/HDR10+/HLG BT.709) inconsistencies #685

Closed cdguy closed 10 months ago

cdguy commented 10 months ago

Hello @kingslay

I am facing inconsistencies with Ksplayer regarding the Dynamic Range Switch.

https://github.com/kingslay/KSPlayer/commit/f572bc1c76e962fca159db36096036702f493341

This last commit broke the way DV, HDR10+ properties are displayed on TV.

Issue 1: If DisplayCriteria is set to off, BT.709 (LiveTV) is considered as HDR and a dynamic range is triggered; however BT.709 content is SDR.

Issue 2 (General one): depending of DisplayCriteria enabled or not; DV works but HDR10+ is displayed as HDR10; or the contrary is happening (DV is broken but HDR10+ work sometimes)

Instead of adding toggles like FormatDescriptionDisplayCriteria ; one unified code would be easier to for everyone, because not all devs have knowledge or adequate equipment to test DV/HDR10+ content.

And it is also a waste of time for you too because every time you make changes to the dynamic range code, something gets broken and you spend your spare time to correct the issue.

I sent to you via e-mail 4 video files. you can either play them with your video player or download them.

djokt commented 10 months ago

Can you update tracy to test 🙂

cdguy commented 10 months ago

@kingslay can you please look at the video named "SDR - BT709" either way, there is no dynamic range switch. BT 709 is a 4K SDR stream.

cdguy commented 10 months ago

@kingslay I figured out that TracyPlayer does not recognize HDR10+ content as it should be. TracyPlayer is displaying the media info as HDR10. ( you can check with the link I sent you before)

Besides, I found a tool that recognizes if the content is in HDR10+ https://github.com/quietvoid/hdr10plus_tool

cdguy commented 10 months ago

https://github.com/quietvoid/dovi_tool https://github.com/Lypheo/vs-placebo

you can also check those if that might help @kingslay

kingslay commented 10 months ago

苹果的系统里面没有AVPlayerHDRModeHDR10+ 这个选项。只有下面三个选项。 typedef NS_OPTIONS(NSInteger, AVPlayerHDRMode) { AVPlayerHDRModeHLG = 0x1, AVPlayerHDRModeHDR10 = 0x2, AVPlayerHDRModeDolbyVision = 0x4, }

cdguy commented 10 months ago

the last code outputs correctly hdr10+ on the TV, I just wanted to underline that the "Video Type" label displays the wrong info when a HDR10+ is played

kingslay commented 10 months ago

目前Video Type 只会返回下面几个值。

   public var description: String {
        switch self {
        case .sdr:
            return "SDR"
        case .hdr10:
            return "HDR10"
        case .hlg:
            return "HDR"
        case .dolbyVision:
            return "Dolby Vision"
        }
    }

目前还无法判断一个视频是HDR10+ 。我会看下你提供的资源。看下能不能找到方法

kingslay commented 10 months ago

@cdguy 所以视频显示是不会有问题。只是Video Type 这个信息显示不对。是不是

cdguy commented 10 months ago

所以视频显示是不会有问题。只是Video Type 这个信息显示不对。是不是

Yes that's correct, the TV displays the correct info

cdguy commented 10 months ago

there is only one issue remaining: BT.709 encoded 4K SDR live streams are displayed SDR in tracy player via the media info page (correct) However, TracyPlayer triggers a Dynamic Range for this kind of stream. the image output should remain in SDR.

I will re-send to you the stream link via e-mail

kingslay commented 10 months ago

这个是因为这个视频的格式是 Stream #0:1[0x101]: Video: hevc (Main 10) (HEVC / 0x43564548), yuv420p10le(tv, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn

视频的位深是10,所以就把它判断成hdr10。 之前我是不会根据位深来判断是不是hdr10,只根据transferFunction来进行判断。但是我记得之前有人提了一个bug。transferFunction是 bt709,但是视频内容是HDR10. 所以只能根据位深来进行判断。所以我们可能要找到一个更好的方式来判断Dynamic Range。不能根据transferFunction和bitDepth

cdguy commented 10 months ago

这个是因为这个视频的格式是 Stream #0:1[0x101]: Video: hevc (Main 10) (HEVC / 0x43564548), yuv420p10le(tv, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn

视频的位深是10,所以就把它判断成hdr10。 之前我是不会根据位深来判断是不是hdr10,只根据transferFunction来进行判断。但是我记得之前有人提了一个bug。transferFunction是 bt709,但是视频内容是HDR10. 所以只能根据位深来进行判断。所以我们可能要找到一个更好的方式来判断Dynamic Range。不能根据transferFunction和bitDepth

I will close this thread as this issue is a rare one; thank you for your hard work!!