Say I ramify a video stream to 2 ffplay processes

cat video.mp4 |  tee >(ffplay -i -) >(ffplay -i -) > /dev/null

Now, if I kill one of the ffplay process, the stream is stopped which is not what I want.

How can I modify this command to continue to stream the video to the first ffplay process if the second is killed?

PS: I am looking for a solution without named pipe (fifo)


A solution

cat video.mp4 |  tee >(ffplay -i - || cat >/dev/null ) >(ffplay -i - || cat >/dev/null) > /dev/null

Example: to save an encrypted webcam capture and play it at the same time with possible killing of the file saving process (openssl) or the player (ffplay), I can use:

ffmpeg -f alsa -ac 2 -i plughw:0,0 -f video4linux2 -s vga -i /dev/video0 -f ogg - | tee >(openssl enc -k mypassword -aes-256-cbc > encrypted-capture.aes-256-cbc || cat >/dev/null) >(ffplay -fs -i - || cat >/dev/null) > /dev/null

You have to kill the ffplay process ( press f and then run pkill ffplay), not close the window with Esc

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.