GithubHelp home page GithubHelp logo

HDR Displays a Solid Blue Screen about iina HOT 6 OPEN

CreepyHobo avatar CreepyHobo commented on June 26, 2024
HDR Displays a Solid Blue Screen

from iina.

Comments (6)

tvBilly avatar tvBilly commented on June 26, 2024

Just started using IINA three days ago, so take this with a grain of salt, but:

I was playing around in the (HDR) Tone Mapping settings, and I noticed that if I specified Algorithm: gamma I got a blue screen when playing HDR movies. I also found that the linear Algorithm was the only one that worked properly.

YMMW

from iina.

low-batt avatar low-batt commented on June 26, 2024

Similar to many open source projects IINA is layered on top of other projects. For audio/video playback and subtitle rendering support IINA is using a library from the mpv project. When it comes to HDR the majority of the work is done by mpv, but IINA is involved as well.

Support for HDR is very sensitive to technical details such as the codec used by the video file, the specific chip the Mac has, the characteristics of the screen the video is being displayed on, etc. To determine what is going on in this case I'd want a copy of the IINA and mpv log files. I'll include instructions on how to obtain log files below, but first…

I'd like to thank @tvBilly for pointing out that setting Algorithm to gamma results in a blue screen. This setting:
gamma

Testing playing The World in HDR in 4K (ULTRA HD) with the above setting on my MacBookPro18,2 with the M1 Max chip and XDR display reproduced the blue screen reported by @tvBilly.

That IINA setting merely controls the value IINA passes to the mpv tone-mapping option:

--tone-mapping=<value>
Specifies the algorithm used for tone-mapping images onto the target display. This is relevant for both HDR->SDR conversion as well as gamut reduction (e.g. playing back BT.2020 content on a standard gamut display). Valid values are:

  • auto
    Choose the best curve according to internal heuristics. (Default)
  • gamma
    Fits a logarithmic transfer between the tone curves.

IINA also defaults to auto. With the default setting I do not see the blue screen. The video plays fine in HDR.

At this moment we are working on upgrading IINA's dependencies, including mpv. I tested setting algorithm to gamma a development version of IINA using upgraded dependencies and did not experience the blue screen. Likely the blue screen problem has been fixed by mpv.

If you want we can take a look and see if the log files tell us anything about the problem.

To enable logging follow these instructions:

  • Start IINA
  • Click on Settings… under the IINA menu
  • The settings panel appears
  • On the left side of the panel click on Advanced
  • Slide the Enable advanced settings toggle button to be on (blue)
  • Click on the checkbox Enable logging to file
  • Confirm the settings panel looks like the screenshot below
  • Restart IINA to activate logging
    enable-logging

Once IINA has restarted, play the video and reproduce the blue screen. Then:

  • Click on Settings… under the IINA menu
  • The settings panel appears
  • On the left side of the panel click on Advanced
  • Click on Open log directory
  • A new Finder window appears containing the logs for this session
  • Quit IINA to complete the log files

The Finder window contains two files, iina.log and mpv.log. To attach the log files to this issue, drag-n-drop them from the Finder window to the Leave a comment section below. Include both the iina.log and the mpv.log

The log files can also be accessed using Terminal as shown here:

low-batt@gag com.colliderli.iina$ pwd
/Users/low-batt/Library/Logs/com.colliderli.iina
low-batt@gag com.colliderli.iina$ ls
2022-10-04-17-57-15_jVrbWy
low-batt@gag com.colliderli.iina$ cd 2022-10-04-17-57-15_jVrbWy
low-batt@gag 2022-10-04-17-57-15_jVrbWy$ ls
iina.log	mpv.log
low-batt@gag 2022-10-04-17-57-15_jVrbWy$ 

With logging enabled IINA creates a new log directory each time it is started. If accessing the logs using Terminal be sure to obtain them from the latest log directory.

DO NOT FORGET to disable logging once you have obtained log files for the problem being investigated. IINA does not restrict the size of log files or delete old logs. If you leave logging enabled the logs will continue to accumulate.

from iina.

tvBilly avatar tvBilly commented on June 26, 2024

@low-batt : Not sure if you need me to provide any log files, as you can duplicate the blue screen on your MacBookPro M1 and like you, the other Algorithms don't blue-screen for me. Plus you mention the current mpv doesn't blue screen on the gamma Algo anyway...

That said, for a bit of reference, I'm on a (new to me) iMacPro, (2.5 GHz 14-Core Intel Xeon W, Radeon Pro Vega 64X 16 GB, 128 GB DDR4, macOS Ventura 13.6.7). Your MacBookPro is probably faster :) .

As I mentioned in my msg above, the only Algo that works remotely well is the linear version. The other ones all map badly, clipping whites, including the auto Algo. Not sure which Algo the auto Algo is choosing, but it's not the linear one and it's not correct. I used a scene in Lucy (UHD HDR SMPTE ST 2086, PQ, MCLL 1000 cd/m2) that shows a white haired man whose hair is NOT in the clippers in the video. The linear Algo maps the transfer properly, the rest don't even come close.

My iMacPro screen is rated at 500 nits, once the Algo is set to linear and the tone mapping is manually set to 500 nits, the whites track properly. Set to 600 nits they start clipping and set to 400 nits everythine is a bit dimmer than it need be, with nothing gained by lowering the setting below what the monitor is capable of. When the mapping is set to 0 (auto) it works correctly on my iMacPro, mimicking what I see when I manually set 500 nits.

Anything I can check for you, just ask.

Billy

from iina.

low-batt avatar low-batt commented on June 26, 2024

@tvBilly I don't think I need logs from you. I'm pretty sure we are seeing the same problem. We need to know how @CreepyHobo encountered this problem and whether it is the same problem we are seeing.

The part of this functionality that IINA supplies is determining the setting for Target peek when that setting is set to 0. This IINA setting controls the value IINA sets for the mpv target-peak option. When IINA is doing this it emits log messages similar to these:

11:05:23.489 [hdr][d] Successfully obtained information about the display
11:05:23.489 [hdr][d] Found ReferencePeakHDRLuminance: 1000

@tvBilly From your report it seems like that part is working.

The tone mapping is done by mpv. From my testing the blue screen failure has been fixed in mpv 0.38.0. I tried to track down a mpv issue reporting that problem, but didn't find one. Lots have changed in mpv, so probably we should investigate this behavior once IINA has been upgraded. That work is in progress.

This is the mpv failure I see when setting Algorithm to gamma:

IINA log:
11:05:23.481 [iina][d] Refreshing HDR for player0 @ display1: "Built-in Retina Display" visible frame (0.0, 32.0, 1728.0, 1047.0) EDR: {supports=true maxPotential=16.0 maxCurrent=1.0}
11:05:23.482 [hdr][d] HDR gamma=pq, primaries=bt.2020, sig_peak=49.261085510253906
11:05:23.482 [hdr][d] Will activate HDR color space instead of using ICC profile
11:05:23.489 [hdr][d] Successfully obtained information about the display
11:05:23.489 [hdr][d] Found ReferencePeakHDRLuminance: 1000
11:05:23.489 [hdr][d] Will enable tone mapping target-peak=1000 algorithm=gamma
11:05:23.516 [iina][d] Refreshing HDR for player0 @ display1: "Built-in Retina Display" visible frame (0.0, 32.0, 1728.0, 1047.0) EDR: {supports=true maxPotential=16.0 maxCurrent=1.0049192905426025}
11:05:23.516 [hdr][d] HDR gamma=pq, primaries=bt.2020, sig_peak=49.261085510253906
11:05:23.516 [hdr][d] HDR mode already enabled, skipping
11:05:23.516 [player0][d] Track list changed
11:05:23.520 [thumbcache][d] Finished reading thumbnail cache, 53 in total
11:05:23.659 [mpv][e] [libmpv_render] error: fragment shader source:
11:05:23.659 [mpv][e] [libmpv_render] error: [  1] #version 410
11:05:23.659 [mpv][e] [libmpv_render] error: [  2] #define tex1D texture
11:05:23.659 [mpv][e] [libmpv_render] error: [  3] #define tex3D texture
11:05:23.659 [mpv][e] [libmpv_render] error: [  4] #define LUT_POS(x, lut_size) mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x))
11:05:23.659 [mpv][e] [libmpv_render] error: [  5] out vec4 out_color;
11:05:23.659 [mpv][e] [libmpv_render] error: [  6] in vec2 texcoord0;
11:05:23.659 [mpv][e] [libmpv_render] error: [  7] in vec2 texcoord1;
11:05:23.659 [mpv][e] [libmpv_render] error: [  8] in vec2 texcoord2;
11:05:23.659 [mpv][e] [libmpv_render] error: [  9] uniform mat3 colormatrix;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 10] uniform vec3 colormatrix_c;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 11] uniform vec3 src_luma;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 12] uniform vec3 dst_luma;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 13] uniform sampler2D texture0;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 14] uniform vec2 texture_size0;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 15] uniform mat2 texture_rot0;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 16] uniform vec2 texture_off0;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 17] uniform vec2 pixel_size0;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 18] uniform sampler2D texture1;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 19] uniform vec2 texture_size1;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 20] uniform mat2 texture_rot1;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 21] uniform vec2 texture_off1;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 22] uniform vec2 pixel_size1;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 23] uniform sampler2D texture2;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 24] uniform vec2 texture_size2;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 25] uniform mat2 texture_rot2;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 26] uniform vec2 texture_off2;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 27] uniform vec2 pixel_size2;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 28] void main() {
11:05:23.659 [mpv][e] [libmpv_render] error: [ 29] vec4 color = vec4(0.0, 0.0, 0.0, 1.0);
11:05:23.659 [mpv][e] [libmpv_render] error: [ 30] color.r = 64.250000 * vec4(texture(texture0, texcoord0)).r;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 31] color.g = 64.250000 * vec4(texture(texture1, texcoord1)).r;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 32] color.b = 64.250000 * vec4(texture(texture2, texcoord2)).r;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 33] color = color.rgbr;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 34] color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 35] color.a = 1.0;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 36] // color mapping
11:05:23.659 [mpv][e] [libmpv_render] error: [ 37] // linearize
11:05:23.659 [mpv][e] [libmpv_render] error: [ 38] color.rgb = clamp(color.rgb, 0.0, 1.0);
11:05:23.659 [mpv][e] [libmpv_render] error: [ 39] color.rgb = pow(color.rgb, vec3(1.0/78.843750));
11:05:23.659 [mpv][e] [libmpv_render] error: [ 40] color.rgb = max(color.rgb - vec3(0.835938), vec3(0.0)) 
11:05:23.659 [mpv][e] [libmpv_render] error: [ 41]              / (vec3(18.851562) - vec3(18.687500) * color.rgb);
11:05:23.659 [mpv][e] [libmpv_render] error: [ 42] color.rgb = pow(color.rgb, vec3(6.277395));
11:05:23.659 [mpv][e] [libmpv_render] error: [ 43] color.rgb *= vec3(49.261084);
11:05:23.659 [mpv][e] [libmpv_render] error: [ 44] color.rgb *= vec3(1.0/49.261086);
11:05:23.659 [mpv][e] [libmpv_render] error: [ 45] color.rgb *= vec3(49.261086);
11:05:23.659 [mpv][e] [libmpv_render] error: [ 46] // HDR tone mapping
11:05:23.659 [mpv][e] [libmpv_render] error: [ 47] int sig_idx = 0;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 48] if (color[1] > color[sig_idx]) sig_idx = 1;
11:05:23.659 [mpv][e] [libmpv_render] error: [ 49] if (color[2] > color[sig_idx]) sig_idx = 2;
11:05:23.659 [player0][d] Playback restarted
11:05:23.674 [mpv][e] [libmpv_render] error: [ 50] float sig_max = color[sig_idx];
11:05:23.674 [mpv][e] [libmpv_render] error: [ 51] float sig_peak = 49.261086;
11:05:23.674 [mpv][e] [libmpv_render] error: [ 52] float sig_avg = 0.250000;
11:05:23.674 [mpv][e] [libmpv_render] error: [ 53] vec3 sig = min(color.rgb, sig_peak);
11:05:23.674 [mpv][e] [libmpv_render] error: [ 54] sig *= 1.0/4.926108;
11:05:23.674 [mpv][e] [libmpv_render] error: [ 55] sig_peak *= 1.0/4.926108;
11:05:23.674 [mpv][e] [libmpv_render] error: [ 56] float sig_orig = sig[sig_idx];
11:05:23.674 [mpv][e] [libmpv_render] error: [ 57] float slope = min(1.000000, 0.250000 / sig_avg);
11:05:23.674 [mpv][e] [libmpv_render] error: [ 58] sig *= slope;
11:05:23.674 [mpv][e] [libmpv_render] error: [ 59] sig_peak *= slope;
11:05:23.674 [mpv][e] [libmpv_render] error: [ 60] const float cutoff = 0.05, gamma = 1.0/1.800000;
11:05:23.674 [mpv][e] [libmpv_render] error: [ 61] float scale = pow(cutoff / sig_peak, gamma.x) / cutoff;
11:05:23.674 [mpv][e] [libmpv_render] error: [ 62] sig = mix(scale * sig,          pow(sig / sig_peak, vec3(gamma)),          bvec3(greaterThan(sig, vec3(cutoff))));
11:05:23.674 [mpv][e] [libmpv_render] error: [ 63] float coeff = max(sig[sig_idx] - 0.036540, 1e-6) / 
11:05:23.674 [mpv][e] [libmpv_render] error: [ 64]               max(sig[sig_idx], 1.0);        
11:05:23.674 [mpv][e] [libmpv_render] error: [ 65] coeff = 0.900000 * pow(coeff / 4.926108, 0.200000);            
11:05:23.674 [mpv][e] [libmpv_render] error: [ 66] color.rgb *= sig[sig_idx] / sig_orig;        
11:05:23.674 [mpv][e] [libmpv_render] error: [ 67] color.rgb = mix(color.rgb, 4.926108 * sig, coeff); 
11:05:23.674 [mpv][e] [libmpv_render] error: [ 68] color.rgb *= vec3(0.020300);
11:05:23.674 [mpv][e] [libmpv_render] error: [ 69] // delinearize
11:05:23.674 [mpv][e] [libmpv_render] error: [ 70] color.rgb = clamp(color.rgb, 0.0, 1.0);
11:05:23.674 [mpv][e] [libmpv_render] error: [ 71] color.rgb *= vec3(49.261086);
11:05:23.674 [mpv][e] [libmpv_render] error: [ 72] color.rgb *= vec3(1.0/49.261084);
11:05:23.674 [mpv][e] [libmpv_render] error: [ 73] color.rgb = pow(color.rgb, vec3(0.159302));
11:05:23.674 [mpv][e] [libmpv_render] error: [ 74] color.rgb = (vec3(0.835938) + vec3(18.851562) * color.rgb) 
11:05:23.674 [mpv][e] [libmpv_render] error: [ 75]              / (vec3(1.0) + vec3(18.687500) * color.rgb);
11:05:23.674 [mpv][e] [libmpv_render] error: [ 76] color.rgb = pow(color.rgb, vec3(78.843750));
11:05:23.674 [mpv][e] [libmpv_render] error: [ 77] out_color = color;
11:05:23.674 [mpv][e] [libmpv_render] error: [ 78] }
11:05:23.674 [mpv][e] [libmpv_render] error: fragment shader compile log (status=0):
11:05:23.674 [mpv][e] [libmpv_render] error: ERROR: 0:61: Swizzle of non-vector primitive float
11:05:23.674 [mpv][e] [libmpv_render] error: ERROR: 0:62: Use of undeclared identifier 'scale'
11:05:23.674 [mpv][e] [libmpv_render] error: 
11:05:23.674 [mpv][e] [libmpv_render] error: shader link log (status=0): ERROR: One or more attached shaders not successfully compiled

from iina.

CreepyHobo avatar CreepyHobo commented on June 26, 2024

So I don't have the knowledge you guys have about video playback/files specifics, but this happened when I started a 2160p HDR file and the blue screen appeared. After looking at your previous posts I looked at my video settings and saw the algorithm was set to gamma. So I changed it to auto and I haven't seen the blue screen since. I hope this helps.

from iina.

low-batt avatar low-batt commented on June 26, 2024

@CreepyHobo When investigating problems I am always looking for evidence to "line up". When it doesn't it usually means I've missed something. I was worried Algorithm might not have been configured as gamma in your case. That it was is a good indication that we are all reproducing the same problem. So thank you for your update. Very helpful.

On not having knowledge, do not hesitate to ask me to clarify/explain something I've posted. I am always happy to do that. By the way, I am operating outside of my area of expertise when it comes to this aspect of IINA. I too lack knowledge in this area.

I reported above that an IINA built with a newer version of mpv did not exhibit the problem. At that point we had only tested Apple Silicon. We now have the upgraded mpv working on Intel and the problem still exists. Apparently it is only half fixed? I will need to try and reproduce this problem directly with mpv and report it to that project. I'm currently juggling lots of work, so it may be a while before I have a chance to do that.

from iina.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.