Acquiring a video of arbitrary duration

We are using TX2 with Leopard Imaging CSI cameras, and are currently calling some 30 images according to this post here:

We are facing the same problem with dark images, and the solution works well, but since we are acquiring multiple images at different times, it makes sense to capture a video and extract images from it occasionally. So, either of these solutions would work:

  1. How to initialize a stream with gst-launch-1.0 nvcamerasrc that is interrupted at an arbitrary time from command line (ideally from python, because we initiate the command with os.system)? I guess we can kill the process somwhow but that might corrupt the video.

  2. Is there a way to stream the video to a node but occasionally (at arbitrary times, with a command) capture a JPG image? This would be similar to 1), but we wouldn’t need the video at all.

Thanks in advance!

Not really understand the first question.
For the second question below command should be help

sudo gst-launch-1.0 nvcamerasrc num-buffers=1 ! video/x-raw\(memory:NVMM\),format=I420 ! nvvidconv ! nvjpegenc ! filesink location=test.jpeg

For both questions - imagine I have a robot, and I initialize a video stream with some command, and then I order the robot to start moving. Whenever I reach a room, I want to take a picture - e.g. save a frame from that video. (this is my second question). And when I am done, I want to stop recording the video, but I am not sure how (this is my first question).

As for your answer, it takes a single photo right away while still unstable, so the photo is very dark (exactly the issue we are trying to avoid). Our idea is to capture from video stream as the white balance is usually controlled.


I completely understand your question. That is a very common use case when creating video/audio products based on Gstreamer. Because of that RidgeRun created an Open Source software named GstDaemon (GstD) to easily control gstreamer pipelines and easily create your full customized system based on requirements and functionalities.

Here you can find complete guide explaining what is GstD and what you can do with it:

Also, here you can find the source code in case you want to give it a try:

Don’t hesitate on contact us if you have questions or comments.

  • Carlos R.

You can reference to the nvgstcapture-1.0