Hello everyone,
I have been searching for streaming processed video over network. I cannot stream anything using gstreamer not only for processed frames.
Steps:
1- Capture input stream (done)
2- Process video (done)
3- Display the processed image (done)
4- Stream processed image (NOT DONE)
I need help on 4th step. I tried to do it with opencv videowriter.
stream.py
import cv2
cap = cv2.VideoCapture("/home/nvidia/Downloads/s1.mp4")
out = cv2.VideoWriter("appsrc ! video/x-raw, format=BGR ! queue ! videoconvert ! video/x-raw, format=BGRx ! nvvidconv ! omxh264enc ! video/x-h264, stream-format=byte-stream ! h264parse ! rtph264pay pt=96 config-interval=1 ! udpsink host=127.0.0.1 port=5001", cv2.CAP_GSTREAMER, 0, 25.0, (1920,1080))
while cap.isOpened():
ret, frame = cap.read()
if ret:
if out.isOpened():
out.write(frame)
print('writing frame')
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
# Release everything if job is finished
cap.release()
out.release()
command for displaying the stream
gst-launch-1.0 -e udpsrc port=50001 ! application/x-rtp, encoding-name=H264, payload=96 ! queue ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! video/x-raw, format=BGRx ! videoconvert ! xvimagesink
I can not view the stream.