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

Error when using nvv4l2camerasrc to get data from a virtual device created by v4l2loopback #544

Closed
tunghason opened this issue May 22, 2023 · 6 comments
Assignees
Labels
duplicate there's already a bug describing the same problem. please enhance the original issue. kind:bug topic:kernel things regarding the actual kernel module

Comments

@tunghason
Copy link

tunghason commented May 22, 2023

Hi,
I get errors when using nvv4l2camerasrc plugin to get data from a virtual device created by v4l2loopback.

My environment

  • v4l2loopback version: v0.12.7

  • kernel version: 5.10.104-tegra

  • Distribution (+version): Ubuntu 20.04.5 LTS

  • Jetson xavier nx: JetPack 5.0.2.

  • Deepstream and Gstreamer version are 6.1.1 and 1.16.3 corresponding.

Describe the problem:

Steps to reproduce:

  1. Create virtual devices:
    sudo modprove v4l2loopback devices=2
    
  2. Clone the data stream:
    gst-launch-1.0 nvv4l2camerasrc device=/dev/video0 ! 'video/x-raw(memory:NVMM), format=UYVY' \
      ! nvvidconv ! identity drop-allocation=true ! queue ! v4l2sink device=/dev/video2
    
  3. Get data from the virtual device /dev/video2 using nvv4l2camerasrc:
    gst-launch-1.0 nvv4l2camerasrc device=/dev/video2 ! 'video/x-raw(memory:NVMM), format=UYVY' \
      ! nvvideoconvert ! fpsdisplaysink video-sink=fakesink --verbose
    

Observed Results:

  • I get "Internal data stream error" like this:

image

Expected Results:

  • When I use v4l2src plugin to get data from the virtual device by the command below, it works normally:

    gst-launch-1.0 v4l2src device=/dev/video2 ! 'video/x-raw' ! fpsdisplaysink video-sink=fakesink sync=false -v
    

    And logs like this:
    image

  • For more information, nvv4l2camerasrc will work normally on the source device /dev/video0.

@umlaeute
Copy link
Owner

does it still happen with current main (5eaff75)?

@tunghason
Copy link
Author

tunghason commented May 22, 2023

Yeah, if I build at main branch, it still happen.
And one more issue at main branch is that I can not use nvv4l2camerasrc to clone data stream anymore, I must use v4l2src in this command below to clone data stream:

gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-raw, format=UYVY' ! queue ! v4l2sink device=/dev/video2

@tunghason
Copy link
Author

Hello @umlaeute, is this still in progress ? Is there any chance to use nvv4l2camerasrc to get data from loopback devices ?

@umlaeute
Copy link
Owner

i don't have a tegra-hardware, so I cannot test (nor solve) the issue.
so: no, there's no active pursuit of this issue (from my side).

in any case: try adding tee and/or queue elements (they often take care of sync-problems between gst-elements).

apart from that: why do you need to access the loopback device with nvv4l2camerasrc instead of the normal v4l2src? due to the nature of the loopback device, i'm not sure whether it will give you any performance improvements...

@tunghason
Copy link
Author

Ok, thank you.
About "why need nvv4l2camerasrc", I've tested nvv4l2camerasrc on the source device (/dev/video0), and I see that nvv4l2camerasrc is better than v4l2src in the aspect of speed and CPU usage, so I expect I will get the same effect on virtual devices, too.

@umlaeute
Copy link
Owner

umlaeute commented May 26, 2023

i did a quick google-check and found this:

The nvv4l2camerasrc plugin default currently supports only DMABUF (importer role) streaming I/O mode with V4L2_MEMORY_DMABUF.

the v4l2loopback device currently only supports V4L2_MEMORY_MMAP, so that might explain why it's not working.

i'm therefore closing this as a duplicate of #501 (in case you wonder: #501 is about the underlying issue, whereas this bug-report is about a symptom; hence i'm closing this one in favour of the other)

@umlaeute umlaeute added kind:bug duplicate there's already a bug describing the same problem. please enhance the original issue. topic:kernel things regarding the actual kernel module and removed needs triage new issues labels May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate there's already a bug describing the same problem. please enhance the original issue. kind:bug topic:kernel things regarding the actual kernel module
Projects
None yet
Development

No branches or pull requests

2 participants