reading video from named pipe, h264
I am getting raw video from netcat and passing it to the pipe
nc -l -p 5777 -v > fifo
then i am trying to read the pipe and display the result in the python script
import cv2
import sys
video_capture = cv2.VideoCapture(r'fifo')
video_capture.set(cv2.CAP_PROP_FRAME_WIDTH, 640);
video_capture.set(cv2.CAP_PROP_FRAME_HEIGHT, 480);
while True:
# Capture frame-by-frame
ret, frame = video_capture.read()
if ret == False:
pass
cv2.imshow('Video', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything is done, release the capture
video_capture.release()
cv2.destroyAllWindows()
However I just end up with an error
[mp3 @ 0x18b2940] Header missing this error is produced by the command video_capture = cv2.VideoCapture(r'fifo')
When I redirect the output of netcat on PC to a file and then reads it in python the video works, however it is speed up by 10 times approximately.
How can I process a h264 video from a named pipe ? The VideoCapture doesnt seem to work well, as I can not open it.
EDIT: What am I trying to achieve is displayed on following video as method 3 : https://www.youtube.com/watch?v=sYGdg...
I'm also interested in the answer to this. It seems like
VideoCapture
is designed either to accept video from a camera that it knows how to interface with or a file, but not from individually supplied raw buffers of data.I have same issue. Any ideas, how to solve it?