How to capture and record video using deep stream in python

I am using Deep Stream for the first time.How can we capture and record video using deep stream?

DeepStream is a streaming analytic toolkit to build AI-powered applications. If you just want to do capture and recording, it is not recommended to use DeepStream.

I want record the video and then need to analyse players movement and cock movement in a badminton court

What kind of camera(CSI, rtsp, USB)?

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU)
• DeepStream Version
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

Hardware paltform - Jetson nano
Deepstream version 5.0
Jetpack version 4.5
TensorRT 7.1.3

I actually require an example which provides the facility to record a video from CSI camera using deep stream in python platform

There is sample of deepstream-test1-usbcam can be referred. You just need to change the source for your CSI camera and change the sink to filesink.

I modified the code with the changes you have mentioned.But when I tried to run it, it gives
Then I cheked the len(args),it shows 1.So it is exiting .

Can you use “gst-launch-1.0” tool to confirm your pipeline with the device first?

NVIDIA Jetson Linux Developer Guide : Multimedia | NVIDIA Docs

gst-launch-1.0 (

Now I got a new issue that Gst.ElementFactory.make(“nvvideoconvert”, “convertor1”) is returning none value.
Actually what should be the parameters given inside Gst.ElementFactory.make() for csi camera

Gst.ElementFactory.make() is to create an instance of an element. Your parameter looks fine.

Can you use “gst-launch-1.0” tool to confirm your pipeline with the device first?

NVIDIA Jetson Linux Developer Guide : Multimedia | NVIDIA Docs

gst-launch-1.0 (

Can you run “gst-inspect-1.0” to check whether your JetPack multimedia and deepstream are all installed correctly?

The device works fine.I run a simple program to capture video using opencv and deepstream.But when I run the example code, this problem is happening.

What is your opencv gstreamer pipeline?

opencv is software path, deepstream is HW accelerated path because we need to do inference with GPU. You need to check the HW pipeline with gst-launch-1.0.

Can you run ‘v4l2-ctl -d /dev/video0 --list-formats-ext’ with your platform?

And please try the camera pipeline in the Jetson document first to check the compatibility. NVIDIA Jetson Linux Developer Guide : Multimedia | NVIDIA Docs

It is saying
v4l2-ctl:unrecognized option ‘–list-format-ext’

gst-launch-1.0 nvarguscamerasrc ! ‘video/x-raw(memory:NVMM),
width=(int)1920, height=(int)1080, format=(string)NV12,
framerate=(fraction)30/1’ ! nvoverlaysink -e

I have run this command and it works fine.

I don’t know your camera node. You need to set the correct node name. The web page will change the double dash to one dash. You can google the correct command

If the following pipeline can work, you can modify your code according to the pipeline. Please set the correct sensor-id.

gst-launch-1.0 nvarguscamerasrc bufapi-version=true sensor-id=0 ! ‘video/x-raw(memory:NVMM),width=1920,height=1080,framerate=30/1,format=NV12’ ! m.sink_0 nvstreammux name=m batch-size=1 width=1280 height=720 ! nvinfer config-file-path=/opt/nvidia/deepstream/deepstream-5.0/samples/configs/deepstream-app/config_infer_primary.txt ! nvtracker tracker-width=640 tracker-height=480 ll-lib-file=/opt/nvidia/deepstream/deepstream-5.0/lib/ enable-batch-process=1 ! nvvideoconvert ! ‘video/x-raw(memory:NVMM),format=RGBA’ ! nvmultistreamtiler ! nvosd ! nvvideoconvert ! nvegltransform ! nveglglessink

while I run this command I got a warning saying:
WARNING:erroneous pipeline:no element “nvstreammux”

can you run “gst-inspect-1.0 nvstreammux” to check whether your deepstream has been installed correctly?