I have a process outputing an MJPEG video stream, which I pipe into ffmpeg
to reduce framerate and then to a socket.
raspivid -t 999999 -cd MJPEG -w 1920 -h 1080 -o - | ffmpeg -i - -f mjpeg -r 2 - | nc -l 9010
Now I need to also split the original raw stream into another socket. I've tried tee
command, including with named fifos, but I cant seem to make it work.
ffmpeg ... | tee >(nc -l other_port) | nc -l 9010
. Notice thatnc -l
is not a real server: it will exit after servicing a connection. – Uncle Billy Feb 7 at 3:04raspivid -t 999999 -cd MJPEG -w 1920 -h 1080 -o - | tee >(nc -l 9011) | ffmpeg -i - -f mjpeg -r 2 - | nc -l 9010
. This does seem to work for a few moment, but than stops. I'm thinking you are right in suggesting that real problem lies with the nature ofnc
, will look more into it. – Ivan Koshelev Feb 7 at 14:04raspivid
program doesn't handle blocking writes well, and it was only tested with "fast" outputs, like regular files or pipes connected to programs which immediately read everything from it -- like ffmpeg. – Uncle Billy Feb 7 at 19:54