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

Unable to open capture device: dshow #369

Open
shreyasvedpathak opened this issue Jan 17, 2024 · 6 comments
Open

Unable to open capture device: dshow #369

shreyasvedpathak opened this issue Jan 17, 2024 · 6 comments
Assignees

Comments

@shreyasvedpathak
Copy link

System information

  • OS: Windows 11
  • CPU: 13th Gen Intel(R) Core(TM) i5-13500T 1.60 GHz
  • RAM: 8.00 GB (7.70 GB usable)
  • Ultragrid version: UltraGrid 1.8.6 (tags/v1.8.6 rev 6328048 built Oct 20 2023 14:45:44)

Description

Unable to see camera feed via ultragrid gui or cli. The camera is visible using the following command:

.\uv -t dshow:help

list-devices-using-dshow

We are able to see the camera feed via other applications like OBS studio, python opencv script and inbuilt camera application. Same camera when attached to a linux based OS (in our case, ubuntu 20.04) is working as expected (using v4l2 instead of dshow).

Command:

.\uv --capture-filter resize:1/2,every:2 -t dshow:device="Cam Link 4K":mode=0:RGB -c libavcodec:encoder=libx264:threads=1 192.168.0.251

Output:

UltraGrid 1.8.6 (tags/v1.8.6 rev 6328048 built Oct 20 2023 14:45:44)
 
Display device   : none
Capture device   : dshow
Audio capture    : none
Audio playback   : none
MTU              : 1500 B
Video compression: libavcodec:encoder=libx264:threads=1
Audio codec      : PCM
Network protocol : UltraGrid RTP
Audio FEC        : none
Video FEC        : none
 
[dshow] vidcap_dshow_init: Cannot connect capture filter to sample grabber.
Unable to start video capture device dshow
Unable to open capture device: dshow
Exit

We received same output when using device index instead of device name in the above command.

We also tried without the extra options but we got same the error

.\uv -t dshow:2 -d gl

Output:

...
...
...
[dshow] vidcap_dshow_init: Cannot connect capture filter to sample grabber.
Unable to start video capture device dshow
Unable to open capture device: dshow
Exit

basic-command

We are running into a tight deadline and any help here would be greatly appreciated.

@MartinPulec MartinPulec self-assigned this Jan 18, 2024
MartinPulec added a commit that referenced this issue Jan 19, 2024
@MartinPulec
Copy link
Collaborator

Hi, thanks for reporting. I can confirm that NV12 pixel format was not possible to capture. I've already tried to fix the issue, the fix should be in already built continuous builds. Could you please try it out?

@shreyasvedpathak
Copy link
Author

Hi @MartinPulec. Thank you so much for your quick response.

We did try the new build and now we are able to detect our camera in the gui and stream the frames using cli. However, the colors of frame do not match the original frame's color.

Camera attached to Ubuntu system:
camera-attached-to-ubuntu-system

Camera attached to Windows system:
It looks like grayscale image with 3 channels.
camera-attached-to-windows-system

We are able to see the expected colors on windows system via other applications like the inbuilt camera app and OBS studio.

MartinPulec added a commit that referenced this issue Jan 22, 2024
refers to GH-369

chroma from first row was used for every column

\+ use ptrdiff_t vars to fix a warning for narrow type multiplication
MartinPulec added a commit that referenced this issue Jan 22, 2024
refers to GH-369

chroma from first row was used for every column

\+ use ptrdiff_t vars to fix a warning for narrow type multiplication
@MartinPulec
Copy link
Collaborator

However, the colors of frame do not match the original frame's color.

You are right, actually the chroma from first line was copied to all the rows below. Unfortunately I've tested it just with color bars, which didn't expose this particular problem.

Anyways, it should be already fixed and the it should be already rebuilt at the same place as before.

@shreyasvedpathak
Copy link
Author

Thanks @MartinPulec, it worked.

@shreyasvedpathak
Copy link
Author

Hi @MartinPulec,

The continuous build you provided is functioning well. We were anticipating that the fix would be incorporated into the recent releases. However, upon testing the latest and several recent builds (1.9.4, 1.9.3, and 1.9.2), we encountered a similar error when attempting to stream using NV12 mode. Please refer to the attached screenshot showing the issue when trying to start streaming with the 'Cam Link 4K' device.

2024-07-11-15-36-44

We would like to take advantage of the updates from the latest release, so we would greatly appreciate it if the fix could be included in regular builds/upcoming release.

@MartinPulec
Copy link
Collaborator

Hi @shreyasvedpathak, I've just verified that all fixes above should be in all versions starting with 1.9. (If I am not mistaken, the changes were incorporated directly to 1.9 release, not backported to dot-releases.)

I've looked into it a bit and it doesn't seem to be entirely the same thing as the above. The main difference in your use is the keyword :RGB, which you didn't use before. Let me slightly explain, how it modifies UG DShow behavior:

  1. without RGB - the codecs (in this case NV12) are taken "as is" from DShow and handled by UG (which also means that those need to be known to UltraGrid)
  2. with RGB - the DShow API is told to convert the camera output to RGB regardless what is the input codec

so in your case it simply means that the DShow API is not capable to convert NV12 to RGB.

I am unsure if there is much to be done to work around this.

Anyways, is it really important for you to convert to RGB? The thing is that, NV12 is a YCbCr, pixel format, anyways, and most of the compressions work with YCbCr rather than RGB. If it is really needed, you can use something like -F change_pixfmt:RGB -t dshow:device=2:mode=2, where the conversion is done rather by UltraGrid.

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