Comments (17)
@kekyo I'm tried to detect my device with V4L2 Devices().Enumerate Descriptors()
and surprised for detected 2nd shadow copy of device placed in /dev/video0
:
Here it seemed strange to me that the devices are listed in reverse order ([/dev/video1, /dev/video0]), or I’m wrong.
from flashcap.
My problem solved, I use my second device.
from flashcap.
@SignalMQ The next version will support NV12 format. Perhaps devices that were not enumerated (or were Unknown) will become available, so if you are interested, please give it a try.
from flashcap.
Thanks for reached out!
If FlashCap is the latest, Characteristics
cannot handle are also enumerated as Unknown
formats. However, I could not understand why they are not enumerated at all, including them. Can we try other cameras?
from flashcap.
I tried code below on my second computer:
using FlashCap;
using SkiaSharp;
var devices = new CaptureDevices();
var descriptor0 = devices.EnumerateDescriptors().ElementAt(0);
byte[] imageData = await descriptor0.TakeOneShotAsync(descriptor0.Characteristics.FirstOrDefault());
using (var ms = new MemoryStream(imageData))
{
SKBitmap bitmap = SKBitmap.Decode(ms);
SKFileWStream fs = new("photo.png");
bitmap.Encode(fs, SKEncodedImageFormat.Png, quality: 100);
}
Other cam:
Logi C270 HD WebCam (USB\VID_046D&PID_0825&MI_00\6&29B00C26&0&0000)
OS:
Windows 11 Enterprise 22H2
Detected and works perfectly, but in my laptop same situation
from flashcap.
Thanks for reached out!
If FlashCap is the latest,
Characteristics
cannot handle are also enumerated asUnknown
formats. However, I could not understand why they are not enumerated at all, including them. Can we try other cameras?
I dont have other cameras on this device, because it's laptop.
from flashcap.
@SignalMQ On #126 and #127, maybe these issues were a factor. #124 may also affect stable operation, so can I try it after merging these?
from flashcap.
@SignalMQ On #126 and #127, maybe these issues were a factor. #124 may also affect stable operation, so can I try it after merging these?
I don't understand, what you meaning in 'so can I try it...'. I'm try these fixes or you?
from flashcap.
Oh, sorry if it doesn't make sense, I made a mistake in the translation program 😵💫
Could you try it with a commit from current develop
branch?
from flashcap.
Hello @kekyo. I am building nupkg
from develop
branch but this error appears above.
from flashcap.
Characteristics [VideoCharacteristics[]]:
{FlashCap.VideoCharacteristics[0]}
Description [string]:
"usb-0000:03:00.4-3: uvcvideo"
DeviceType [DeviceTypes]:
V4L2
Identity [object]:
"/dev/video1"
Name [string]:
"USB2.0 HD UVC WebCam: USB2.0 HD"
Non-Public members
here is my decriptors info
from flashcap.
@SignalMQ Sorry later, I am interested in what characteristics are enumerated in your camera. The following sections:
return (CaptureDeviceDescriptor)new V4L2DeviceDescriptor(
devicePath, ToString(caps.card), $"{ToString(caps.bus_info)}: {ToString(caps.driver)}",
EnumerateFormatDesc(fd).
SelectMany(fmtdesc =>
EnumerateFrameSize(fd, fmtdesc.pixelformat).
SelectMany(frmsize =>
EnumerateFramesPerSecond(fd, fmtdesc.pixelformat, frmsize.Width, frmsize.Height).
Collect(framesPerSecond =>
NativeMethods_V4L2.CreateVideoCharacteristics(
fmtdesc.pixelformat, frmsize.Width, frmsize.Height,
framesPerSecond.Value, ToString(fmtdesc.description),
frmsize.IsDiscrete && framesPerSecond.IsDiscrete)))).
Distinct().
OrderByDescending(vc => vc).
ToArray());
Here, if a series of SelectMany()
returns no result, the number of characteristics is zero. Such a possibility would be if EnumerateFormatDesc()
, EnumerateFrameSize()
, or EnumerateFramesPerSecond()
returned zero elements. Your camera may fall into one of these cases.
This line is written on a single line, so it may be difficult to verify. For example:
var a = EnumerateFormatDesc(fd).ToArray();
var b = a.SelectMany(fmtdesc =>
{
var c = EnumerateFrameSize(fd, fmtdesc.pixelformat).ToArray();
var d = c.SelectMany(frmsize =>
{
// ...
});
// ...
});
to change the enumeration so that you can check the enumeration and be sure of it on the debugger.
from flashcap.
I was surprised too! I'm not sure why there are multiple /dev/video?
enumerations in the first place, but I'm not particularly aware of the order:
FlashCap/FlashCap.Core/Devices/V4L2Devices.cs
Line 171 in 854186a
If you select /dev/video1
, will it capture correctly?
from flashcap.
I was surprised too! I'm not sure why there are multiple
/dev/video?
enumerations in the first place, but I'm not particularly aware of the order:FlashCap/FlashCap.Core/Devices/V4L2Devices.cs
Line 171 in 854186a
If you select
/dev/video1
, will it capture correctly?
/dev/video1
- fail
/dev/video0
- sucess
from flashcap.
According to the screenshot, /dev/video0
has zero characteristics and /dev/video1
enumerates several characteristics, did you succeed in the case of /dev/video0
?
Are you saying that you used the value of /dev/video1
as the characteristic in that case?
from flashcap.
According to the screenshot,
/dev/video0
has zero characteristics and/dev/video1
enumerates several characteristics, did you succeed in the case of/dev/video0
?Are you saying that you used the value of
/dev/video1
as the characteristic in that case?
/dev/video0
has 12 characteristics and it's work, but /dev/video1
enumerated in first is not work, because don't have any characteristics listed.
from flashcap.
I see. As a coping remedy, it seems that we need to ignore devices with zero characteristics.
We could ignore devices with zero characteristics when internal FlashCap enumerates them, but I imagine that would probably make it difficult to identify the problem.
Therefore, I would like to make it a policy that this exclusion is handled by the caller. For example:
if (devices.EnumerateDescriptors().
FirstOrDefault(d => d.Characteristics.Any(c => c.PixelFormat != PixelFormats.Unknown)) is { } device)
{
// `device` is valid.
}
from flashcap.
Related Issues (20)
- Is there any way to set camera parameters like white balance, exposure on linux? HOT 1
- Blue screen error without stopping HOT 1
- Capture Error event handler HOT 1
- SET the power line frequency property HOT 1
- After running StartAsync() on linux, executing StopAsync() and then StartAsync(), pixelBufferArrived will not be executed again. HOT 4
- Typo in Linux device enumeration HOT 3
- Reversed logic when enumerating Linux device capabilities HOT 3
- 执行OpenAsync时发生异常 HOT 1
- Elgato CamLink 4K DirectShow Pixel Format HOT 4
- Capture works first time on Linux, but not subsequent times HOT 4
- How to do shrink memory when capturing from WebCam to WPF HOT 2
- Avalonia aot 启动失败
- Is there a camera snapshot event handler? HOT 1
- AutoPixelBufferScope set PixelBuffer to null, cause allocate new PixelBuffer for every frame HOT 3
- Possible leaks in AsyncLock HOT 1
- Desktop Screen Capture Support HOT 1
- Support for camera module/ CSIconnector on Pi Zero 2W HOT 3
- OnPixelBufferArrived can not get new YUYV buffer in v1.10.0 (v1.9.0 is ok) HOT 5
- Support for AV to USB HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flashcap.