Ask Your Question

Rycco's profile - activity

2020-03-26 19:30:33 -0600 received badge  Popular Question (source)
2016-06-20 22:22:19 -0600 received badge  Student (source)
2016-02-03 04:16:53 -0600 asked a question 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...