I am trying to use the camera feed on my Jetson Nano (running headless over SSH) in 2 different applications.
From the command line, I am able to run
gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=3280, height=2464, format=NV12, framerate=(fraction)21/1' ! nvvidconv ! xvimagesink
Which streams video from my camera (IMX219 connected to the Jetson Nano) to my desktop via an X11 Window.
What I would like to do is somehow use that same video stream in 2 different applications. My first application is a python program that runs some OpenCV stuff, the second application is a simple bash script which records video to an *.mp4 file.
Is such a thing possible? I have looked into using v4l2loopback, but I'm unsure if that is really the simplest way to do this.
Well, I managed to figure it out thanks to both commentors, here is my solution on my Jetson Nano, but it can be tweaked for any Gstreamer application.
First, use
v4l2loopbackto create 2 virtual devices like so:That will create
/dev/video1and/dev/video2Then you use
teeto dump a Gstreamer stream into each of these virtual devices, here is my line:This is specifically for my Jetson Nano and my specific camera, but you can change the gstreamer pipeline to do what you wish