Cant pause/resume gst-launch with SIGUSR1/2 signal

I have a simple playback pipeline wich runs fine but i want to pause/resume the stream on a certain command.

In the official gst-launch documentation there is the SIGUSR1 and SIGUSR2 command for pause/resume a pipeline.

A pipeline can be controlled by signals. SIGUSR2 will stop the pipeline (GST_STATE_NULL ); SIGUSR1 will put it back to play (GST_STATE_PLAYING ).

If i send the signal with kill -USR2 PID or kill -SIGUSR2 PID the whole process is killed instead of paused.
Is this behaviour not implemented in the nvidia jetpack release?

Hi,
You can try to call gst_element_set_state() to set the pipeline to PAUAED or PLAYING.

Thank you for that suggestions. I solved it and do a short documentation here for anyone else who had this problem now or in the future.

I came from a command line pipeline started by python like this

command = f"gst-launch-1.0 filesrc location='{video_path}' ! qtdemux ! queue ! h265parse ! nvv4l2decoder ! nvvidconv ! videorate rate={self.playback_speed} ! 'video/x-raw(memory:NVMM), format=NV12, framerate=(fraction){self.r}/{self.i}' ! nvoverlaysink display-id=1"
self.proc = subprocess.Popen(shlex.split(command))

With this pipeline i am able to control playback speed and also framerate of a input video file. Now i wanted to pause this video on purpose. I tried it with a self.proc.send_signal(signal.SIGUSR2) but this stops the whole subprocess instead of pause the video playback. Also sending kill -SIGUSR2 $PID from commandline did exit the whole process

Now i did a rewrite of the pipeline from commandline gst-launch to a gstreamer api pipeline in python.

By setting the player state into player.set_state(Gst.State.PAUSED) the video stops and can be resumed by setting it back to player.set_state(Gst.State.PLAYING)

Thanks for the hint.

If anyone is interested in a full pipeline example leave me a note.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.