I am trying to stream video to a named pipe (fifo). I do this by creating a fifo and then passing it as a filename to the VideoWriter constructor. This does not seem to be the right way to do it. How can I stream video to a fifo?
This is the code I used (in python)
import cv2
import os
import stat
# Create a fifo
path = '/tmp/c0'
os.unlink(path)
os.mkfifo(path)
# Make sure it's a fifo
mode = os.stat("/tmp/c0").st_mode
print(stat.S_ISFIFO(mode)) # True
# Open a videostream to the fifo
fourcc = cv2.VideoWriter_fourcc(*'MJPG')
stream = cv2.VideoWriter('/tmp/c0', fourcc, 20.0, (640,480))
# Is it still a fifo?
mode = os.stat("/tmp/c0").st_mode
print(stat.S_ISFIFO(mode)) # False (I was hoping for True here)