سؤال

Or more specifically is there a way to take stdout from one command, run another command, and then use stdout as the stdin for the next command? e.g. cat file.txt| run_command | grep "foo"

This may seem confusing as to why someone would want to do this. Here is what I am trying to do:

I feed the webcam on my other computer (remote) to my local computer via ssh user@remote ffmpeg -b 100k -an -f video4linux2 -s 320x280 -r 10 -i /dev/video0 -b 100k -f ogg - | vlc -

I am trying to do the reverse. So, send a feed from my webcam (local) to display on the remote machine. It tryed: ffmpeg -b 100k -an -f video4linux2 -s 320x280 -r 10 -i /dev/video0 -b 100k -f ogg - | ssh user@remote vlc -

which doesn't work because before I have to "export DISPLAY=:0.0" on the remote machine before I can launch vlc. So I'm trying to get the output from ffmpeg to vlc on the remote computer AFTER exporting the DISPLAY variable for that ssh 'session'. Also if there is another way to do this (besides using ssh on the remote maching to use the first command) I would love to try it.(also if there is a way to do the same thing that doesn't lag so much I would appreciate the info, though that's not really relevant to the question) Thanks in advance. :)

هل كانت مفيدة؟

المحلول

To pass the output from source as an input to sink given that run_command must end before sink is run in your case:

source | { run_command &>/dev/null; sink; }
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top