UnityPlugin-AVProMovieCapture
UnityPlugin-AVProMovieCapture copied to clipboard
The recorded video quality has obvious color difference
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):
- Unity version: unity_vision - 2019.3.14
- AVPro Movie Capture version: vision 4.3.3
- Operating system version: Windows 10
- Capture component used: Use camera to record UI-Canvas
- Capture settings (resolution, frame-rate, codec): 1920 * 1080 ; 25 FPS ; H264
To Reproduce Steps to reproduce the behavior:
- Go to 'movie capture'
- Click on 'start capture',after a few seconds, Click on 'stop capture‘
- Compare the video with the original UI element
- 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 :
Original material:
Videos If applicable, add a copy of your video or the URL
Thanks, we will investigate this and get back to you.
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?
Hi,
We have tried, but haven't managed to replicate the problem. I have a few questions:
- Which codec are you using for the encoding?
- Is your Unity colorspace set to Gamma or Linear?
- Are you using any extra components such as HDRP?
- Are you using Forward or Deferred rendering?
- Which GPU is this running on?
- 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:
Thanks,
- Which codec are you using for the encoding? Answer:Do you mean video encoding: "H264"?
- Is your Unity colorspace set to Gamma or Linear? Answer:Gamma
- Are you using any extra components such as HDRP? Answer:No
- Are you using Forward or Deferred rendering? Answer:No
- Which GPU is this running on? Answer:Nvidia GeForce GTX 1660,6G
- 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
@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,
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?
@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.
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:
- Windows 10.0.19042
- Geforce RTX 2080 Ti
- Unity 2019..4.24f1 (using Gamma color space)
- AVpro Movie Capture 4.6.2
- HDRP: no
- Forward or Deferred rendering: no
- h264 codec
Let me know if I can provide any more info to you!
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?
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)
This is still happening in 4.6.4. Is there a pending solution for this?
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
- Unity version: 2020.3.42f1
- AVPro Movie Capture version: 5.1.1 basic
- Operating system version: Android 12
- Capture component used: Screen capture
- Capture settings (resolution, frame-rate, codec): 1080x2340, 30 FPS, H264
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?
Hi @fengx1024 .
Please can you delete that project and send to our email [email protected]. Are you able to post comparison videos? Which colourspace are you using? How does it look in the other one?
@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.
Hey @fengx1024, please continue in issue #229 as it is a separate issue to this one (being specific to Android and not Windows)
@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