How to turn off auto-capture when gstreamer pipeline runs? only on-demand

Our use case is to capture images/snapshots on demand, which is very similar to nvgstcapture when “j” clicked.

As we go through the sample code and create our own pipeline basically just running
capbin → cap_tee → ienc_q → svc_imgbin → img_bin

with copying the part of trigger_image_capture() and the callback cam_image_captured().

We couldn’t figure out how to start the pipeline and keep it in an idle mode (if that’s the right word). Like in nvgstcapture, only when “j” clicked, there is a frame captured and go through the pipeline.

But in our own application, there are frames going through the pipeline constantly. We’ve checked “mode” for nvtee, and “intent”/“trigger” for nvcamerasrc, but still coudn’t figure out.

Update:
I guess my question is how to turn off the auto-capture after the pipeline runs. Capturing only on-demand.
I edit the title.

Please help. Thanks a lot.

Please refer to
[url]https://devtalk.nvidia.com/default/topic/1043245/jetson-tx2/storing-camera-footage-in-jpeg-files-with-format/post/5292078/#5292078[/url]

Thanks a lot for the reply. Our application is in C.

Are you suggesting we need to check on “num-buffers”?

Hi Michael,
The pipeline is continuous jpeg encoding. I misunderstood your usecase.

So in your application, do you use nvcamerasrc? The element nvcamerasrc implements intent and trigger properties for on-demand jpeg encoding. If you don’t use nvcamerasrc, the function may not work.

Hi Michael,
Please refer to attachment.

# Install 
sudo apt-get install libgstreamer1.0-dev
sudo apt-get install libgstreamer-plugins-base1.0-dev

# compile with below command
g++ -Wall -std=c++11  gst_jpg_on_demand.cpp -o test $(pkg-config --cflags --libs gstreamer-app-1.0)

gst_jpg_on_demand.zip (1.61 KB)

Hello Dane,

Yes, we use nvcamerasrc and its properties intent/trigger trying to duplicate what nvgstcapture does when “j” clicked. While nvgstcapture pass a sinlge frame, our pipeline continuously has data. We are trying to figure out how to idle the pipeline. Thanks a lot for the reply.

Thanks for the sample. It captures two images when frame_count = 123/168 in each run.

When it’s not saving the frame to a jpeg, there are still data/frame running in the pipeline which is similar to what our application does.

My question is, is it possbile to idle/freeze the pipeline after “GST_STATE_PLAYING”, during which no data running. Until user sends request, then there is a single frame/buffer passsing through the pipeline and saved to a jpg.

“nvgstcapture” seems to like that, but we couldn’t figure out the trick at this moment.

[quote=“DaneLLL”]

Hi Michael,
Please refer to attachment.

Hi Michael,
You can build full nvgstcapture and remove the part not required in your usecase. There are four source pads in nvtee: pre_src, img_src, vid_src, vsnap_src. Looks like vid_src and vsnap_src are not required in your usecase.

Please check attachment.
r28_2_1_nvgstcapture.zip (25 KB)

Thanks a lot.

Hey Michael,

Did you figure out a solution for this? I’m trying to accomplish the same. Thanks!

Check the source code of nvgstcapture-1.0 by Nvidia.

Will do. If you happen to have any modified source/binary you could share it would be appreciated. No worries if you can’t though. Thanks!

I was able to easily add a SIGINT handler for triggering images:

Seems to be working well.

2 Likes