I’m facing to a problem that I don’t know if is caused by OpenCV or Gstreamer.
If my Python script tries to write to an offline RTMP server, Pyhon remains stucked and there is no way to recover it.
I need to kill process with “-9” in order to terminate it brutally.
... rtmpUrl = 'rtmp://127.0.0.1/live/camera1' send_gst = "appsrc ! videoconvert ! video/x-raw,format=BGRx ! nvvidconv ! nvv4l2h264enc bitrate=4000000 ! video/x-h264,stream-format=(string)byte-stream,alignment=(string)au ! h264parse ! queue ! flvmux name=mux ! rtmpsink location=" + rtmpUrl out_stream = cv2.VideoWriter(send_gst, 0, stream_fps, (stream_width, stream_height)) while True: ... out_stream.write(frame_output) ... ...
If RTMP server is online all works properly but if RTMP is offline, the script remains stucked.
I also tried to write in try/except way:
while True: ... try: out_stream.write(frame_output) except: out_stream.release() ... ...
but seems that it remains stucked in gstreamer pipeline, I don’t know how to solve…
I also tried this solution:
but without no luck…
Python Version: 2.7.17 (default installed in Jetson Nano Image)
Opencv Version: 3.3.1 (default installed in Jetson Nano Image)
Gstreamer Version: 1.14.5 (default installed in Jetson Nano Image)