0

I'am using a raspberry and i need 2 local streams. This is what i've tried:

Attempt

raspivid <some options> -o - | tee nc localhost 5100 | nc localhost 5000

Question

I can receive the output on 5000 but not on 5100, what am i missing?

raspivid -o - spits the stream to stdout.

1 Answer 1

2

Well, 'tee' does not take command names – it takes file names. You're writing copies of the output to files named nc, localhost, and 5100 in the current directory.

If you want to run two commands, check if your shell allows "process substitution" using >( ... ), automatically passing a pipe as the file name:

raspivid <etc> | tee >(nc localhost 5100) | nc localhost 5000

Alternatively, install pee from moreutils:

raspivid <etc> | pee "nc localhost 5100" | nc localhost 5000

If neither of those options are available, use mkfifo to create a named pipe for one of the 'nc' instances, then run the output and the input separately:

mkfifo /tmp/ncpipe
nc localhost 5100 < /tmp/ncpipe &
raspivid <etc> | tee /tmp/ncpipe | nc localhost 5000
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .