Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add P010 HDR10 video format support #968

Merged
merged 1 commit into from
Nov 24, 2024
Merged

Add P010 HDR10 video format support #968

merged 1 commit into from
Nov 24, 2024

Conversation

awawa-dev
Copy link
Owner

@awawa-dev awawa-dev commented Oct 31, 2024

Tested on Windows with Elgato HD60X.
LUT calibration also supports P010 format.

381767398-edd23306-0a72-4713-bbc0-3ad3a29d3ce4

@satgit62
Copy link

satgit62 commented Nov 2, 2024

@awawa-dev
Hello,
My UGREEN P010 Grabber arrived today.
Unfortunately, I cannot elicit/set a p010 video mode under my Windows 11.
I have used your branch “Add P010 HDR10 video format support”. https://github.com/awawa-dev/HyperHDR/actions/runs/11638667810
Do I need to pay attention to anything else?
UGREEN
UGREEN1
UGREEN2

UGRENp010

@awawa-dev
Copy link
Owner Author

awawa-dev commented Nov 2, 2024

Check out logs, it should lists all available modes there. Is the HDR signal connected to the grabber?

Edit:
RGB/YUV modes are also missing. Maybe the USB cable is not good enough - I had a similar journey with my elgato.

@satgit62
Copy link

satgit62 commented Nov 2, 2024

Yes, it may be due to the USB cable. I can't connect the original cable, which is included, to my PC/laptop because I don't have a USB-C port.
And with the data cable from my cell phone, I only get that:

2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1280 x 720 @ 30 fps NV12 (nv12)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1280 x 720 @ 25 fps NV12 (nv12)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 640 x 480 @ 60 fps NV12 (nv12)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 640 x 480 @ 50 fps NV12 (nv12)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 640 x 480 @ 30 fps NV12 (nv12)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 640 x 480 @ 25 fps NV12 (nv12)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1280 x 720 @ 30 fps I420 (i420)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1280 x 720 @ 25 fps I420 (i420)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 640 x 480 @ 60 fps I420 (i420)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 640 x 480 @ 50 fps I420 (i420)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 640 x 480 @ 30 fps I420 (i420)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 640 x 480 @ 25 fps I420 (i420)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1920 x 1080 @ 60 fps NV12 (nv12)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1920 x 1080 @ 60 fps MJPG (mjpeg)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1920 x 1080 @ 50 fps NV12 (nv12)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1920 x 1080 @ 50 fps MJPG (mjpeg)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1920 x 1080 @ 30 fps NV12 (nv12)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1920 x 1080 @ 30 fps MJPG (mjpeg)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1920 x 1080 @ 25 fps NV12 (nv12)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1920 x 1080 @ 25 fps MJPG (mjpeg)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1280 x 720 @ 60 fps NV12 (nv12)
2024-11-02T19:52:25.246Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1280 x 720 @ 60 fps MJPG (mjpeg)
2024-11-02T19:52:25.247Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1280 x 720 @ 50 fps NV12 (nv12)
2024-11-02T19:52:25.247Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1280 x 720 @ 50 fps MJPG (mjpeg)
2024-11-02T19:52:25.247Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1280 x 720 @ 30 fps NV12 (nv12)
2024-11-02T19:52:25.247Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1280 x 720 @ 30 fps MJPG (mjpeg)
2024-11-02T19:52:25.247Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1280 x 720 @ 25 fps NV12 (nv12)
2024-11-02T19:52:25.247Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 1280 x 720 @ 25 fps MJPG (mjpeg)
2024-11-02T19:52:25.247Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 640 x 480 @ 60 fps NV12 (nv12)
2024-11-02T19:52:25.247Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 640 x 480 @ 60 fps MJPG (mjpeg)
2024-11-02T19:52:25.247Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 640 x 480 @ 50 fps NV12 (nv12)
2024-11-02T19:52:25.247Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 640 x 480 @ 50 fps MJPG (mjpeg)
2024-11-02T19:52:25.247Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 640 x 480 @ 30 fps NV12 (nv12)
2024-11-02T19:52:25.247Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 640 x 480 @ 30 fps MJPG (mjpeg)
2024-11-02T19:52:25.247Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 640 x 480 @ 25 fps NV12 (nv12)
2024-11-02T19:52:25.247Z [MEDIA_FOUNDATION:UGREEN 25173] UGREEN 25173 640 x 480 @ 25 fps MJPG (mjpeg)
2024-11-02T19:52:25.459Z [MEDIA_FOUNDATION:UGREEN 25173] *************************************************************************************************
2024-11-02T19:52:25.459Z [MEDIA_FOUNDATION:UGREEN 25173] Starting MF grabber. Selected: 'UGREEN 25173' 1280 x 720 @ 60 fps nv12
2024-11-02T19:52:25.459Z [MEDIA_FOUNDATION:UGREEN 25173] *************************************************************************************************
2024-11-02T19:52:25.459Z [MEDIA_FOUNDATION:UGREEN 25173] Init UGREEN 25173, 1280 x 720 @ 60 fps (NV12) => \?\usb#vid_3188&pid_1000&mi_00#6&792477d&0&0000#{e5323777-f976-4f5b-9b55-b94699c46e44}\global
2024-11-02T19:52:25.468Z [PROTOSERVER] Started on port 19445
2024-11-02T19:52:25.472Z [MEDIA_FOUNDATION:UGREEN 25173] Device opened successfully
2024-11-02T19:52:25.473Z [MEDIA_FOUNDATION:UGREEN 25173] Brightness set to: 0 (default)
2024-11-02T19:52:25.473Z [WEBSERVER] Started: 'HyperHDR WebServer (HTTP)' on port: 8090
2024-11-02T19:52:25.488Z [MEDIA_FOUNDATION:UGREEN 25173] ******************** SUCCESFULLY SET CAPTURE PARAMETERS: 1280 720 nv12 ********************
2024-11-02T19:52:25.488Z [MEDIA_FOUNDATION:UGREEN 25173] (LutLoader.cpp:82) LUT file found: C:/Users/FM/.hyperhdr/lut_lin_tables.3d
2024-11-02T19:52:25.488Z [MEDIA_FOUNDATION:UGREEN 25173] (LutLoader.cpp:92) Index 1 for HDR YUV
2024-11-02T19:52:25.495Z [WEBSERVER] Setup SSL certificate
2024-11-02T19:52:25.495Z [WEBSERVER] Setup private SSL key
2024-11-02T19:52:25.504Z [MEDIA_FOUNDATION:UGREEN 25173] Found and loaded LUT: 'C:/Users/FM/.hyperhdr/lut_lin_tables.3d'
2024-11-02T19:52:25.504Z [MEDIA_FOUNDATION:UGREEN 25173] Started
2024-11-02T19:52:25.506Z [WEBSERVER] Started: 'HyperHDR WebServer (HTTPS)' on port: 8092
2024-11-02T19:52:25.506Z [SSDP] (SSDPHandler.cpp:42) SSDPHandler is initializing
2024-11-02T19:52:25.511Z [MEDIA_FOUNDATION:UGREEN 25173] Received empty image frame: Warning: receive empty sample
2024-11-02T19:52:25.511Z [SSDP] (SSDPHandler.cpp:183) The local address is: 192.168.2.61
2024-11-02T19:52:25.511Z [SSDP] (SSDPServer.cpp:94) Initialize the SSDP server
2024-11-02T19:52:25.512Z [SSDP] Starting the SSDP server
2024-11-02T19:52:25.897Z [DX11_SYSTEM:AUTO] Selected D3D_DRIVER_TYPE_UNKNOWN
2024-11-02T19:52:25.897Z [DX11_SYSTEM:AUTO] Gamut: SDR, min nits: 0.50, max nits: 270.00, max frame nits: 270.00, white point: [0.31, 0.33]
2024-11-02T19:52:25.897Z [DX11_SYSTEM:AUTO] Using BGRA format

UGREEN 25173

@awawa-dev
Copy link
Owner Author

awawa-dev commented Nov 2, 2024

4k capturing is also disabled, only 1080p and compressed formats for limited bandwidth. Did you try to provide 4k signal on the input? But from the symptoms it reminds me of Elgato which behaves similarly if something does not suit it with USB (bad cable, too low port power). But HD60x works with USB-C to USB-C cable and USB-C to USB-A adapter connected to ordinary USB3.0 port. Mine will arrive next week so I will check it thoroughly.

@satgit62
Copy link

satgit62 commented Nov 2, 2024

4k capturing is also disabled, only 1080p and compressed formats for limited bandwidth. Did you try to provide 4k signal on the input? But from the symptoms it reminds me of Elgato which behaves similarly if something does not suit it with USB (bad cable, too low port power). But HD60x works with USB-C to USB-C cable and USB-C to USB-A adapter connected to ordinary USB3.0 port. Mine will arrive next week so I will check it thoroughly.

@awawa-dev
Hello,
You were right, on closer inspection of the accessories, I noticed that a USB A to C was plugged onto the enclosed USB cable. I took it out and connected it directly.

And the result is positive!!!! 😀
UGREEN 25173
UGREN P010

Now I will try to compile the kernel for RPI Bokworm aarch 64 with their help.

@awawa-dev
Copy link
Owner Author

Great! 🚀
BTW P010 must be calibrated. The default LUT wont work well.

@awawa-dev
Copy link
Owner Author

@satgit62 I've found simpler method to patch the uvc-v4l2 module: you do not need to recompile whole kernel. I will post details tomorrow.

@awawa-dev
Copy link
Owner Author

@satgit62
You can compile a single module using an adapted script from here: https://github.com/awawa-dev/P010_for_V4L2/blob/master/patch_v4l2.sh (RPi4) but you have to adapt it to your OS. The kernel will be tainted but it has no major side effects unless you want to report bugs to the organization. It takes around 2-3 minutes only on RPi.

Unfortunately some things in Raspberry Pi OS like the source version cannot be obtain so script hardcode-s them. They have recently given up on kernel version-commit markings and there is no way to determine without detective work which version of the kernel sources they probably used as if they wanted to hide something (it's a joke... I suppose?). And RPi-Distro/rpi-source#34 script doesnt work anymore. The more I dig into Raspberry Pi OS the less I want to.

Building the entire kernel itself takes about an ~hour on RPi 5 with an SSD drive, if you have a weaker configuration and an SD card it will probably take much, much longer. You can try cross-compiling on PC but I didn't feel like it.

An alternative there is my ready SD image with a patched kernel (uvc module only so it's tainted but it doesnt matter) built entirely by Github Action: https://github.com/awawa-dev/P010_for_V4L2/releases/tag/raspios_lite_arm64-2024-10-28

I'm giving up on building full patched & built kernels in my releases because I'd really have to build 2 kernels: one for RPi5 and the other ones. Using the current runners in Github Action and qemu it would probably take a few days ;-) So we're only patching the kernel modules.

@awawa-dev awawa-dev force-pushed the p010 branch 4 times, most recently from fb07309 to 8d7cf62 Compare November 9, 2024 23:48
@awawa-dev awawa-dev force-pushed the p010 branch 2 times, most recently from 81e040b to 1c686f4 Compare November 24, 2024 20:04
@awawa-dev
Copy link
Owner Author

awawa-dev commented Nov 24, 2024

I found a bug in YUV limited detection during calibration and ELgato (and possible Hagabis) for some reason is using full range for HDR P010. Fixed it in the latest commit. I dont have UGreen anymore (it used YUV limited range) to check if the calibration is still working fine also for this grabber. Please re-calibrate P010 LUT in the free time after installing new HyperHDR version.

@awawa-dev awawa-dev merged commit 9bb1b48 into master Nov 24, 2024
15 checks passed
@awawa-dev awawa-dev deleted the p010 branch November 24, 2024 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants