RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
239 stars 29 forks source link

Player changes color slightly #1422

Closed MintX closed 1 year ago

MintX commented 1 year ago

Please DO NOT LINK / ATTACH YOUR PROJECT FILES HERE

Describe the issue Player changes color slightly when played movie

Your Setup (please complete the following information):

To Reproduce

  1. Play white-background movie
  2. Player changes color slightly. (by Screenshot, (255,255,255) -> (254,254,252)

Screenshots

Screenshot_20230105

Videos

https://user-images.githubusercontent.com/13432184/210740840-9df2351e-c9d3-4b7a-89b8-1dc6833df364.mp4

MintX commented 1 year ago

It captured by AVPro Movie Capture Ultra (5.0.5)

Thank you.

MintX commented 1 year ago

And... It occurs on Windows, Android, iOS

Chris-RH commented 1 year ago

Are you using a gamma or linear colour space? Are you using one of the demo scenes? Displaying as UI or on mesh? Which shader are you using? What are the specs of the video you are playing? Is it the same discrepancy on all the devices? Which devices are you using?

MintX commented 1 year ago

Are you using a gamma or linear colour space? Are you using one of the demo scenes? Displaying as UI or on mesh? Which shader are you using? What are the specs of the video you are playing? Is it the same discrepancy on all the devices? Which devices are you using?

We use linear color space.

And display as UI via "Display uGUI" component.

No shader used.

I uploaded video file we are playing.

On Windows, (255, 255, 255) -> (253, 253, 253) On Android and iOS, (255, 255, 255) -> (254, 254, 252)

Android device: Samsung Galaxy Note S20 Ultra iOS device: iPhone 12 Pro Max

Thank you.

MintX commented 1 year ago

I changed color space from Linear to Gamma, but stiil exsit color discrepancy.

Thank you.

Chris-RH commented 1 year ago

And if you play this video on the device in another media player it is the correct colour?

MintX commented 1 year ago

Yes. On Unity's video player, no color discrepancy.

But cannot play well on Android device. (with Error opening extractor: -10004)

Ste-RH commented 1 year ago

Could this be to do with colour ranges of your encoded video?

How are you encoding your videos? You can use ffmpeg to specify full colour ranges.

Off the top of my head the flags are something like:

-vf scale=in_range=limited:out_range=full -color_range 2 -pix_fmt yuv420p -movflags +write_colr

EDIT: Yeah, something like that, see here.

MintX commented 1 year ago

I'm capturing my app's screen in realtime via AVPro Movie Capture .

Is there any options for that?

MintX commented 1 year ago

Anyway, Unity's video player and web player (on this web page) shows the correct colors.

I think it's not problem from encoding, but player's fault.

Thank you.

Ste-RH commented 1 year ago

That is a fair comment. As info, your video is encoded as 'yuvj420p(pc, bt709/bt709/smpte170m)'.

What API are you using on Windows to playback? MediaFoundation I assume...Have you tried WinRT?

MintX commented 1 year ago

I don't use Windows standalone app. For the test only.

Trying on Windows don't help solving the problem :(

MintX commented 1 year ago

Is there any further information for this problem?

Chris-RH commented 1 year ago

Can you provide a sample of the original video that you played in the player please? unitysupport@renderheads.com What are you using to measure the colour? On Android are you using Exoplayer or MediaPlayer?

MintX commented 1 year ago

Uploaded video file on post is original. I took a sceenshot and measured color on image editor like PhotoShop.

Exoplayer and MediaPlayer both shows same color.

Thank you.

Ste-RH commented 1 year ago

I have ran a few tests here using our Demo_MediaPlayer scene.

1) Grabbing a screen shot PNG via Android Studio and checking pixels in Paint.NET. The pixels all around the face are white (attaching screen shot)

Screenshot_20230109_153407

2) Modifying the shader to change pixels 'close to white' to magenta. As you can see, pixels are closer to white than the thresholds you outlined in your original post:

image

https://user-images.githubusercontent.com/46531149/211347157-9de0d914-39f2-48c6-86a0-74fae57e8873.MOV

Is there something else at play in your scene I wonder? The Demo_MediaPlayer scene also uses the Display uGUI component and the 'AVProVideo-Internal-UI-Default-Transparent' shader.

Ste-RH commented 1 year ago

Bit of additional;. The screen shot I attached has the Demo scenes GUI up, which naturally changes the 'white' in the bottom half of the final screen render. Here is one without the GUI showing 'white' everywhere in the background.

Screenshot_20230109_153255

MintX commented 1 year ago

Not only white background color, but also face's color.

NO.1 and NO.3 is AVPro's color (NO.3 is your screen shot)

NO2 is screenshot from Webbrowser. (and it's same color what I captured.)

image

How do you look these colors?

Ste-RH commented 1 year ago

Oh, ok. I see what you are saying. I thought the issue was the white/colour-range specifically. You mean the video is not rendered on Android correctly when compared to the original (and windows it would seem):

image

<edit - have tested the AVPro MediaPlayer API path and also the ExoPlayer demo application>

image

<edit 2 - Comparing to the Unity Video Player>

image

(here is the original screen shot from the above - I just adjusted to show more obviously that they are the same)

image

Ste-RH commented 1 year ago

This looks like a general Android difference. Not sure what we can do to offer a solution as this could also differ by device (GPU and, naturally, screen).

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue has been automatically closed because it has not had recent activity. If you wish to continue this issue, then please create a new issue as we do not monitor closed issues.