How release camera in Gstreamer? and start new pipeline?

Hi, I try record two video use Gstreamer and Python. I can record first file, but can’t write second, when I try pipeline2.set_state(Gst.State.PLAYING) and receive error Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

print(“Start write second file”)

pipeline2 = Gst.parse_launch(
'nvarguscamerasrc gainrange=“1 1” ispdigitalgainrange=“2 2” ! ’


Do you stop and release the first pipeline before running the second pipeline?

The camera may be in use by the first pipeline if the memory is not properly freed.

Just to clarify:
Are you using an application in Python?

Is the camera able to run several times with pipelines using gst-launch?

Greivin F.

Yes, I stop first pipeline pipeline.set_state(Gst.State.NULL)
Yes, I can record two file using gst-launch

My code:

I’ve run into the same problem (trying to access the camera shortly after closing it). My best guess currently is you have to wait more in between. You could try a time.sl33p(10) just after pipeline.set_state(Gst.State.NULL) and see if that fixes it. (if you replace the 3’s with e’s it seems to confuse the forum application firewall, thanks Tom!)

Gstreamer’s Argus source relies on an external daemon to be ready, and if it’s not, this seems to happen. This was dusty_nv’s explanation for why the jetson inferences gstCamera was failing when I was trying to do something similar. I have been busy with something else recently and haven’t had a chance to confirm it 100% but it seems very likely.

You could probably use systemd to poll for the daemon’s status in a loop but I haven’t tried it either. In python you would use“daemon check command here”) and check the .returncode of the subprocess.CompletedProcess returned. 0 means the daemon is running.