Skip to content

Commit 49722b5

Browse files
steveseguinactions-user
authored andcommitted
docs: document V4L2 sink support for virtual camera output
Add detailed documentation for the V4L2 sink feature in README.md, enabling users to present remote VDO.Ninja streams as local system cameras. - List new CLI arguments: --v4l2sink, --v4l2sink-width, --v4l2sink-height, --v4l2sink-fps, and --v4l2sink-format. - Provide usage examples for Raspberry Pi UVC gadgets and virtual camera nodes. - Explain technical details such as automatic writable device detection and the blue-frame keep-alive mechanism. - Clarify the distinction between --v4l2 (input) and --v4l2sink (output). [auto-enhanced]
1 parent 36efdee commit 49722b5

1 file changed

Lines changed: 36 additions & 2 deletions

File tree

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Turn your Raspberry Pi, Nvidia Jetson, Orange Pi, Windows PC, Mac, Linux box, or
55

66
<img src='https://github.com/steveseguin/raspberry_ninja/assets/2575698/0b3c7140-5aed-4b21-babb-3c842e2bc010' width="400"> <img src='https://github.com/steveseguin/raspberry_ninja/assets/2575698/cf301391-0375-45c9-bb1c-d665dd0fe1bb' width="400">
77

8-
It also has the ability to record remote VDO.Ninja streams to disk (no transcode step), record multiple room participants simultaneously, broadcast a low-latency video stream to multiple viewers (with a built-in SFU), and because it works with VDO.Ninja, you get access to its ecosystem and related features. There are other cool things available, such as AV1 support, NDI output, OpenCV output, WHIP, HLS recording, and fdsink output.
8+
It also has the ability to record remote VDO.Ninja streams to disk (no transcode step), record multiple room participants simultaneously, broadcast a low-latency video stream to multiple viewers (with a built-in SFU), and because it works with VDO.Ninja, you get access to its ecosystem and related features. There are other cool things available, such as AV1 support, NDI output, OpenCV output, WHIP, HLS recording, fdsink output, and V4L2 sink output for virtual cameras.
99

1010
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
1111
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
@@ -52,6 +52,7 @@ It also has the ability to record remote VDO.Ninja streams to disk (no transcode
5252
- [NDI Combiner Mode (Optional)](#ndi-combiner-mode-optional)
5353
- [NDI Installation](#ndi-installation)
5454
- [OpenCV / Tensorflow / FFMPEG / FDSink / Framebuffer support](#opencv--tensorflow--ffmpeg--fdsink--framebuffer-support)
55+
- [V4L2 Sink (UVC gadget/virtual camera)](#v4l2-sink-uvc-gadgetvirtual-camera)
5556
- [Hardware options](#hardware-options)
5657
- [Camera options](#camera-options)
5758
- [360-degree cameras](#360-degree-cameras)
@@ -294,7 +295,10 @@ usage: publish.py [-h] [--streamid STREAMID] [--room ROOM] [--rtmp RTMP] [--whip
294295
[--openh264] [--vp8] [--vp9] [--aom] [--av1] [--rav1e] [--qsv] [--omx] [--vorbis] [--nvidia] [--rpi]
295296
[--multiviewer] [--noqos] [--nored] [--novideo] [--noaudio] [--led] [--pipeline PIPELINE]
296297
[--record RECORD] [--view VIEW] [--save] [--midi] [--filesrc FILESRC] [--filesrc2 FILESRC2]
297-
[--pipein PIPEIN] [--ndiout NDIOUT] [--fdsink FDSINK] [--framebuffer FRAMEBUFFER] [--debug]
298+
[--pipein PIPEIN] [--ndiout NDIOUT] [--fdsink FDSINK] [--framebuffer FRAMEBUFFER]
299+
[--v4l2sink V4L2SINK] [--v4l2sink-width V4L2SINK_WIDTH]
300+
[--v4l2sink-height V4L2SINK_HEIGHT] [--v4l2sink-fps V4L2SINK_FPS]
301+
[--v4l2sink-format V4L2SINK_FORMAT] [--debug]
298302
[--buffer BUFFER] [--password [PASSWORD]] [--hostname HOSTNAME] [--video-pipeline VIDEO_PIPELINE]
299303
[--audio-pipeline AUDIO_PIPELINE] [--timestamp] [--clockstamp]
300304
@@ -380,6 +384,15 @@ options:
380384
--fdsink FDSINK VDO.Ninja to the stdout pipe; common for piping data between command line processes
381385
--framebuffer FRAMEBUFFER
382386
VDO.Ninja to local frame buffer; performant and Numpy/OpenCV friendly
387+
--v4l2sink V4L2SINK Viewer output to V4L2 device; requires --view STREAMID
388+
--v4l2sink-width V4L2SINK_WIDTH
389+
V4L2 sink output width (default: 1280)
390+
--v4l2sink-height V4L2SINK_HEIGHT
391+
V4L2 sink output height (default: 720)
392+
--v4l2sink-fps V4L2SINK_FPS
393+
V4L2 sink output framerate (default: 30)
394+
--v4l2sink-format V4L2SINK_FORMAT
395+
V4L2 sink output format (default: YUY2)
383396
--debug Show added debug information from Gsteamer and other aspects of the app
384397
--buffer BUFFER The jitter buffer latency in milliseconds; default is 200ms, minimum is 10ms. (gst +v1.18)
385398
--password [PASSWORD]
@@ -730,6 +743,27 @@ There's support for OpenCV/Framebuffer (--framebuffer STREAMIDHERE) and FDSink n
730743

731744
This should allow you to use Tensorflow, OpenCV, or whatever Python script to access the webRTC video stream as raw frames. You can also use it to turn a webRTC stream into a motion-JPEG stream, useful if needing to publish to a device that doesn't support webRTC. ie: Octoprint 3d printer server supports a MJPEG video preview link, but not a webRTC link.
732745

746+
### V4L2 Sink (UVC gadget/virtual camera)
747+
748+
Use V4L2 sink output to present a remote VDO.Ninja stream as a local webcam device (for example, with a Raspberry Pi USB UVC gadget). This outputs fixed-size, fixed-rate YUY2 frames to a chosen `/dev/video*` node.
749+
750+
Example:
751+
```
752+
python3 publish.py --view STREAMIDHERE --v4l2sink 0
753+
```
754+
755+
Optional overrides:
756+
```
757+
python3 publish.py --view STREAMIDHERE --v4l2sink 0 \
758+
--v4l2sink-width 1920 --v4l2sink-height 1080 --v4l2sink-fps 30 --v4l2sink-format YUY2
759+
```
760+
761+
Notes:
762+
- `--v4l2sink` accepts a numeric index (`0`) or a full path (`/dev/video2`).
763+
- If the specified device is not writable, the first writable `/dev/video*` is used.
764+
- When no remote video is available, a blue frame is output to keep the device alive.
765+
- This is output-only; `--v4l2` is input capture.
766+
733767
## Hardware options
734768

735769
Of the Raspberry Pi devices, the Raspberry Pi 4 or the Raspberry Pi Zero 2 are so far the best options on this front, depending on your needs. Any of the Nvidia Jetson devices should work fine, but only the Jetson Nano 2GB, 4GB, and NX have been tested and validated. If you wish to use other Jetson devices, you'll need to setup and install Gstreamer 1.19 yourself on those systems, as no pre-built image will be provided at this time. (Unless someone wishes to donate the hardware that is) Any other Linux system or SBC embedded system is on the user to setup and install at this point, but they should closely follow the same steps that the Nvidia Jetson uses.

0 commit comments

Comments
 (0)