RenderHeads / UnityPlugin-AVProMovieCapture

AVPro Movie Capture is a Unity Plugin for advanced video capture to AVI/MP4/MOV files
https://renderheads.com/products/avpro-movie-capture/
43 stars 8 forks source link

The recorded video quality has obvious color difference #55

Open nostayup opened 4 years ago

nostayup commented 4 years ago

Describe the bug I use the avpro plug-in to shoot the UI screen in unity. There is obvious color difference between the saved video and the original view screen in UI in unity.

Your Setup (please complete the following information):

To Reproduce Steps to reproduce the behavior:

  1. Go to 'movie capture'
  2. Click on 'start capture',after a few seconds, Click on 'stop capture‘
  3. Compare the video with the original UI element
  4. See error

Logs If applicable, add error logs to help explain your problem.

Screenshots Focus on the color of this blackboard, the color in the video is completely different from the color of the original material

Picture of the video recorded by avpro : image Original material: image

Videos If applicable, add a copy of your video or the URL

AndrewRH commented 4 years ago

Thanks, we will investigate this and get back to you.

nostayup commented 4 years ago

Thanks, we will investigate this and get back to you.

Hello,Do you have any progress?Have you seen this color difference in previous use?

AndrewRH commented 4 years ago

Hi,

We have tried, but haven't managed to replicate the problem. I have a few questions:

1) Which codec are you using for the encoding? 2) Is your Unity colorspace set to Gamma or Linear? 3) Are you using any extra components such as HDRP? 4) Are you using Forward or Deferred rendering? 5) Which GPU is this running on? 6) Have you made sure that the GPU isn't doing some sort of colour adjustments during display?

Eg on the Intel and NVidia controls they usually have settings for image and video display: image

Thanks,

nostayup commented 4 years ago
  1. Which codec are you using for the encoding? Answer:Do you mean video encoding: "H264"?
  2. Is your Unity colorspace set to Gamma or Linear? Answer:Gamma
  3. Are you using any extra components such as HDRP? Answer:No
  4. Are you using Forward or Deferred rendering? Answer:No
  5. Which GPU is this running on? Answer:Nvidia GeForce GTX 1660,6G
  6. Have you made sure that the GPU isn't doing some sort of colour adjustments during display? Answer:What I can be sure is that the graphics card is not set, and the graphics card settings are the default values.

Can I know your hardware foundation and related setting parameters? Can you show your comparison results

AndrewRH commented 4 years ago

@nostayup

Thanks for the feedback - very useful! I will show our comparison results soon.

I want to ask - could you try capturing the PNG? I'm curious whether you get the same problem with the colours.

Thanks,

nostayup commented 4 years ago

Sorry, I have a very important message without explanation. I display the picture of the external camera (A Sony camera) to the UI-RawImage in unity, and then use avpro to shoot the RawImage to obtain the video of the external camera. I also tested using avpro to take a picture in the UI-Image, this performance is very good, there is indeed no color difference. Have you tried avpro to take pictures from an external camera? I am also curious, what requirements does avpro have on the hardware on the Windows platform?

caseypugh commented 3 years ago

@AndrewRH Also running into this issue.

Washed out, dark MP4 on left, PNG export on the right. Both exports are pulling from the same exact render texture. image

This is a show stopper for me since a lot of detail is lost. I tried switching movie capture to export a PNG sequence instead, and then I manually used ffmpeg to stitch it together using:

ffmpeg -framerate 60 -pattern_type glob -i *.png -c:v libx264 output.mp4

And the results fixed the color issue. But, I'd rather use movie capture to do the mp4 export since the PNG sequence output takes up so much disk space and generally slower.

My setup:

Let me know if I can provide any more info to you!

caseypugh commented 3 years ago

So, I discovered that I needed to add -pix_fmt yuv420p to my ffmpeg script in order to have better cross platform support. Which now introduces new color space issues. My best output is pretty close to the original, but slightly brighter, rather than AVpro's very dark output. I've tried a bunch of different methods to get the exact color output but it's proving to be difficult!

Perhaps this is not a simple bug for you to fix, but maybe one solution would be to expose more encoder hints in the movie capture settings? e.g. Let people set the colorspace?

caseypugh commented 3 years ago

Hi again, sorry to keep posting but I've learned quite a bit in the last 24 hours and I think I understand what the core issue is. If you use ffprobe to inspect AVPro's outputted video file you get:

Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1920x1920 [SAR 1:1 DAR 1:1], 8527 kb/s, 60 fps, 60 tbr, 60k tbn, 120 tbc (default)

yuvj420(pc) is the issue because it reveals there is no color space set. From what I understand, you want to always set the color space so decoders know how to decode properly. If it's HD you want bt709 and if it's SD you want smpte170m.

And if you want better cross platform/cross browser color space consistency, converting to yuv420p. Here is my final ffmpeg command that takes the avpro video output and converts it to the correct color space.

ffmpeg -y -an -i avpro.mp4
 -vcodec libx264
 -profile:v high
 -level 3
 -crf 16
 -preset:v slow 
 -colorspace bt709 -color_primaries bt709 -color_trc bt709 -color_range tv -pix_fmt yuv420p
 -movflags +faststart out.mp4

ffprobe for this new video file outputs:

 Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1920 [SAR 1:1 DAR 1:1], 9452 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)

And now it has a color space set yuv420p(tv, bt709). I hope this is helpful! I guess the tl;dr is that you should probably expose some encoder hints to set the color space. e.g. yuv420p(tv, bt709) vs yuvj420p(pc, bt709)

v2k commented 2 years ago

This is still happening in 4.6.4. Is there a pending solution for this?

fengx1024 commented 1 year ago

I'm running into this same issue on Android with the latest AVPro Movie Capture plugin version 5.1.1. I have created a project using the trial version that can reproduce the issue: [redacted]

My Setup

The color difference only appears in the video output. If I change the output to image sequence, the generated PNG files will have the correct color. This aligns with the above comment about incorrect color space in the video file: https://github.com/RenderHeads/UnityPlugin-AVProMovieCapture/issues/55#issuecomment-859915372

@AndrewRH Any updates on this issue?

Chris-RH commented 1 year ago

Hi @fengx1024 .

Please can you delete that project and send to our email unitysupport@renderheads.com. Are you able to post comparison videos? Which colourspace are you using? How does it look in the other one?

fengx1024 commented 1 year ago

@Chris-RH I have removed the project and sent the project zip to the email you provided.

Here are 2 videos, one recorded with the android screen recording and the other produced by avpro: https://user-images.githubusercontent.com/56179274/207421771-e0628d63-c75b-4184-8fb6-15623a141af0.mp4 https://user-images.githubusercontent.com/56179274/207421788-f1f9887e-7b5e-4059-86fe-80870c5ec42c.mp4

If you open them in 2 tabs and switch between them, the color difference is very obvious.

The color difference is observable regardless which color space is used. The above video is recorded from a linear colorspace build. The project zip I sent over uses gamma color space and here are 2 screenshots of the same comparison but with gamma colorspace build: https://user-images.githubusercontent.com/56179274/207422939-2e3a4429-25e2-4586-8e3b-854c0652b148.png https://user-images.githubusercontent.com/56179274/207422963-6f8d1c3a-901f-4c86-8b14-7c91f1f5f472.png

Again if you open them in 2 tabs and switch, the color difference is very obvious.

The test is done with the latest 5.1.1 trial version. In the posted video/png above, the one with floating watermark is the one recorded by avpro.

MorrisRH commented 1 year ago

Hey @fengx1024, please continue in issue #229 as it is a separate issue to this one (being specific to Android and not Windows)

dganzella commented 3 months ago

@Chris-RH ?????????????? this issue is 4 year old!! it literally is number 55 and the one I opened is 381,

look it yourself!!! https://github.com/RenderHeads/UnityPlugin-AVProMovieCapture/issues/381

is ther a reason this has not been addressed still? This does not look like a minor issue at all