[ILUG] Piping to multiple processes (which might die)?

From: Ronan Cunniffe (ronan at domain cunniffe.net)
Date: Tue 30 Jul 2002 - 20:00:50 IST


Hi all,
   I've been doing some video compression from VHS using mjpegtools, and trying
different bitrate/quantisation/algorithm mixes to see what gives best results.
The whole thing is a three stage pipeline:

  lav2yuv capture.avi | yuvdenoise | mpeg2enc --lots-of-args -o capture.m1v
       (100 mins) (260 mins) (236 mins)

The times are cpu time for a particular segment of video. All compression runs
use the same first two stages - 360 mins. Obviously, I want to do that once and
send the results to lots of encoding processes.

I did the following:

$ mkfifo f1
$ lav2yuv capture.avi | yuvdenoise | tee f1 | mpeg2enc (blah blah) &
$ cat f1 | mpeg2enc (different blah blah)

And hey! It works! Until somebody dies! Yippe... oh.
I could wrap mpeg2enc in a script that detected a death-by-error and catted the
fifo to /dev/null, but has anyone got a better way of doing this?

Oh, and writing the result of the first to stages to disk is not a better way.
Unless you have a very, very, very big disk. :-)

Ronan



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:18:07 GMT