0

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.

4
  • try with ffmpeg ... | tee >(nc -l other_port) | nc -l 9010. Notice that nc -l is not a real server: it will exit after servicing a connection. – Uncle Billy Feb 7 at 3:04
  • I've tried that, though in different order (it's the raw stream I want expose): raspivid -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 of nc, will look more into it. – Ivan Koshelev Feb 7 at 14:04
  • Maybe that raspivid 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
  • @UncleBilly Yep, I've tried it several more times and it does work from time to time, but definitely not something to rely on. I also discovered that I will need to perform additional processing on the streams, so I'll be handling splitting in code. Thanks. – Ivan Koshelev Feb 7 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.