How do I get a Theta V stream into OBS on a Jetson Nano?

Hello!

I’m trying to get a livestream from my Theta V camera into OBS running on an Nvidia Jetson Nano, so that I can use the OBS NDI Plugin and send the video over NDI to another computer.

So far:

  1. I am successfully getting a 4k stream from my Theta V into my Jetson nano by following the instructions here. Specifically, I’m able to run the ./gst_viewer sample app and see the live stream with reasonably low latency.
  2. After installing v4l2-loopback, I also see a /dev/video0 device listed

However:

  1. I’m still not able to see the device in OBS as a viable/available video device.
  2. FWIW, a simple pipeline like gst-launch-1.0 v4l2src ! xvimagesink also does not work.

Is there something else that I need to do to see the stream as a viable video device (like a USB webcam) so that I can get it into OBS?

Thank you,

Ali

It should appear as a USB webcam. There are some example here:

This video playlist may help.

This video covers running VLC, gstreamer (gst-launch-1.0) and others on a Jetson Nano.

when you run lsmod, can you see the vl42loopback module?

$ lsmod
Module                  Size  Used by
bnep                   16562  2
zram                   26166  4
overlay                48691  0
spidev                 13282  0
v4l2loopback           37383  0
nvgpu                1579891  18
bluedroid_pm           13912  0
ip_tables              19441  0
x_tables               28951  1 ip_tables
craig@jetson:/etc/modules-load.d$ 

Did you try manually inserting the module?

$ sudo modprobe v4l2loopback
$ cd path_to_gst_loopback_directory
$ ./gst_loopback
$ cvlc v4l2:///dev/video2

I don’t know if it is necessary, but you could try this pipeline as a test.

$ gst-launch-1.0 v4l2src device=/dev/video2 ! video/x-raw,framerate=30/1 ! xvimagesink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

Can you see the device with v4l2-ctl ?

Example:

$ v4l2-ctl --list-formats-ext --device  /dev/video2
ioctl: VIDIOC_ENUM_FMT
    Type: Video Capture

    [0]: 'YU12' (Planar YUV 4:2:0)
        Size: Discrete 1920x960
            Interval: Discrete 0.033s (30.000 fps)

Thank you for your help; I have reviewed those videos and I believe I’m on the same page. Here is what I get from the diagnostic commands you provided:

I can see the Theta with lsusb

ali@ali-nano:~/Documents/Dev/libuvc-theta-sample/gst$ lsusb
Bus 002 Device 002: ID 0bda:0411 Realtek Semiconductor Corp. 
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 001 Device 015: ID 05ca:2712 Ricoh Co., Ltd 
Bus 001 Device 002: ID 0bda:5411 Realtek Semiconductor Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Running ./gst_viewer works; I can see my video stream from the theta.

I also see /dev/v4l2loopback and /dev/video0:

ali@ali-nano:~/Documents/Dev$ ls /dev/v*
/dev/v4l2loopback  /dev/vcs1  /dev/vcs3  /dev/vcs5  /dev/vcsa   /dev/vcsa2  /dev/vcsa4  /dev/vcsa6  /dev/video0
/dev/vcs           /dev/vcs2  /dev/vcs4  /dev/vcs6  /dev/vcsa1  /dev/vcsa3  /dev/vcsa5  /dev/vhci

Did you try manually inserting the module?

I did, but I get an error below:

ali@ali-nano:~/Documents/Dev/libuvc-theta-sample/gst$ ls
gst_loopback  gst_viewer  gst_viewer.c  gst_viewer.o  Makefile  thetauvc.c  thetauvc.h  thetauvc.o
ali@ali-nano:~/Documents/Dev/libuvc-theta-sample/gst$ sudo modprobe v4l2loopback
ali@ali-nano:~/Documents/Dev/libuvc-theta-sample/gst$ ./gst_loopback 
start, hit any key to stop
Error: Cannot identify device '/dev/video1'.
stop

I read that the sample assumes I have another camera; I do not; I expect the Theta to show up on /dev/video0.

when you run lsmod , can you see the vl42loopback module?

Yes I can:

ali@ali-nano:~/Documents/Dev/libuvc-theta-sample/gst$ lsmod
Module                  Size  Used by
uvcvideo               90357  0
v4l2loopback           42895  0
fuse                  103841  3
bnep                   16562  2
xt_conntrack            3609  1
ipt_MASQUERADE          2346  1
nf_nat_masquerade_ipv4     3111  1 ipt_MASQUERADE
nf_conntrack_netlink    28859  0
nfnetlink               7959  2 nf_conntrack_netlink
xt_addrtype             3670  2
iptable_filter          2481  1
iptable_nat             2882  1
nf_conntrack_ipv4      11992  2
nf_defrag_ipv4          1836  1 nf_conntrack_ipv4
nf_nat_ipv4             6712  1 iptable_nat
nf_nat                 20406  2 nf_nat_masquerade_ipv4,nf_nat_ipv4
nf_conntrack          105820  6 nf_conntrack_ipv4,nf_conntrack_netlink,nf_nat_masquerade_ipv4,xt_conntrack,nf_nat_ipv4,nf_nat
br_netfilter           16250  0
zram                   26166  4
overlay                48691  0
hid_logitech_hidpp     22721  0
hid_logitech_dj        13813  0
spidev                 13282  0
userspace_alert         5665  0
nvgpu                1580772  32
bluedroid_pm           13912  0
ip_tables              19441  2 iptable_filter,iptable_nat
x_tables               28951  5 ip_tables,iptable_filter,ipt_MASQUERADE,xt_addrtype,xt_conntrack

Can you see the device with v4l2-ctl?

This is what I get; does not look like your output.

ali@ali-nano:~/Documents/Dev/libuvc-theta-sample/gst$ v4l2-ctl --list-formats-ext --device /dev/video0
ioctl: VIDIOC_ENUM_FMT

try this pipeline as a test.

This pipeline does not work for me; gst-launch quits:

ali@ali-nano:~/Documents/Dev/libuvc-theta-sample/gst$ gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,framerate=30/1 ! xvimagesink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...

I also tried a different USB webcam and confirmed that I can capture it in OSB, or via gstreamer.

What do you think?

Regards,
Ali

In the source code, of gst_viewer.c, specify /dev/video0 recompile.

Please report back on results either way. You’re providing excellent information to help us identify the problem.

I made the change you recommended to gst_viewer.c and recompiled with and rebuilt with make.
I don’t perceive any difference:

What I did:

  • made the change to video0 in gs_viewer.c
  • ran make
  • manually loaded the module with sudo modprobe v4l2loopback

What I see is:

  • gst_viewer still works; I can see the video stream on screen
  • both /dev/v4l2loopback and /dev/video0 are present
  • ls -1 /sys/devices/virtual/video4linux returns: video0

However:

  • The gst-launch command still stops as before
  • v4l2-ctl --list-formats-ext --device /dev/video0 still returns ioctl: VIDIOC_ENUM_FMT as before
  • OBS still does not see the video device

Another test I performed was to run libuvc-theta-sample/gst/gst_loopback:

ali@ali-nano:~/Documents/Dev/libuvc-theta-sample/gst$ ./gst_loopback 
start, hit any key to stop
Opening in BLOCKING MODE 
NvMMLiteOpen : Block : BlockType = 261 
NVMEDIA: Reading vendor.tegra.display-size : status: 6 
NvMMLiteBlockCreate : Block : BlockType = 261 
Error: Internal data stream error.
stop

Something I have noticed all along is that the OBS recognizes the microphone on the Theta V and I do get sound input; but no video.

What do you think?