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

why not working in 4K? #36

Open
stweily opened this issue Apr 22, 2024 · 6 comments
Open

why not working in 4K? #36

stweily opened this issue Apr 22, 2024 · 6 comments

Comments

@stweily
Copy link

stweily commented Apr 22, 2024

Why fps = 1 or2 only at 3840 * 2160 resolution? if 1920 * 1080 its nomal at 30 fps.

@secile
Copy link
Owner

secile commented Apr 23, 2024

I have never tested 4k camera.

The library is based on DirectShow which is legacy technology, so that could be the reason.
please refer the article below.
https://stackoverflow.com/questions/63393696/4k-mjpeg-camera-video-preview-with-delay-on-windows-10

The other possibility is a lack of transfer rate.
I'm not familiar with transfer rate or video codec, forgive me if I tell you wrong information.

What VideoFormat are you using? I assume that you are using YUY2 format with USB2.0 interface.

3840 x 2160 image has 8294400 pixels.
Single pixel is consist of RGB 24bit, so single frame is about 23MB with uncompressed.

Video is compressed with YUY2 which compression rate is 66%, single frame is about 15MB.

USB2.0 band width is 480Mbps in spec, but it actually may 240Mbps(=30MB).
Frame rate 1-2fps may be reasonable.

@stweily
Copy link
Author

stweily commented Apr 24, 2024

我从未测试过 4k 相机。

该库基于 DirectShow,这是传统技术,因此这可能就是原因。 请参考下面的文章。 https://stackoverflow.com/questions/63393696/4k-mjpeg-camera-video-preview-with-delay-on-windows-10

另一种可能性是传输速率不足。 我对传输速率或视频编解码器不熟悉,如果我告诉你错误的信息,请原谅我。

您使用什么视频格式?我假设您使用的是带有USB2.0接口的YUY2格式。

3840 x 2160 图像有 8294400 像素。 单个像素由RGB 24bit组成,因此单帧未压缩时约为23MB。

视频采用YUY2压缩,压缩率为66%,单帧约15MB。

USB2.0的带宽规格上是480Mbps,但实际上可能是240Mbps(=30MB)。 帧速率 1-2fps 可能比较合理。

but use AmCap its can 4K 30fps, use WPFMediaKit.Core (also directshow ) it 4K12 FPS!

@secile
Copy link
Owner

secile commented Apr 24, 2024

Oh, really?
Could you show me a dump of return value of UsbCamera.GetVideoFormat().

var formats = UsbCamera.GetVideoFormat(cameraIndex);

// select the format you want.
foreach (var item in formats) Console.WriteLine(item);

@stweily
Copy link
Author

stweily commented Apr 24, 2024

哦真的吗? 你能给我看一下 UsbCamera.GetVideoFormat() 返回值的转储吗?

var formats = UsbCamera.GetVideoFormat(cameraIndex);

// select the format you want.
foreach (var item in formats) Console.WriteLine(item);

format.txt

@secile
Copy link
Owner

secile commented Apr 24, 2024

(1) which VideoFormat are you using? formats[2]? that is [Video], [MJPG], 3840,2160.
(2) formats[0] works fine in 30fps?

@stweily
Copy link
Author

stweily commented Apr 24, 2024

(1) which VideoFormat are you using? formats[2]? that is [Video], [MJPG], 3840,2160. (2) formats[0] works fine in 30fps?

20240424172346
this is amCAP
(1) I will use formats[2] and hope it work,
(2) formats[0] works fine in 24- 28 fps, its ok
this is our UsbCamera

1713951009575

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants