Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a bash script that is using anonymous pipes to achieve:

  • grabbing video from dv capture device
  • writing to a file (using tee)
  • piping it to ffmpeg2theora (converting to ogv/theora video)
  • writing to a file (using tee)
  • piping it to oggfwd in order to send it to icecast streaming server

How could I achieve that using named pipes (fifos), so that I could have separate processes that I could separately control?

I was using this script:

 #!/bin/bash
 while (true); 
 do
    dvgrab --format dv1 - | \
    tee /filename_`date +%y%m%d_%H%M%S`.dv | \
    ffmpeg2theora.linux -f dv -x 382 -y 288 -v 3 --speedlevel 2 --no-skeleton -o /dev/stdout - | \
    tee /filename_`date +%y%m%d_%H%M%S`_stream_382x288.ogv | \
    oggfwd icecastserver.com 8000 password /mountpoint.ogv
done

One of the reasons I'm asking this is that I need to have clean dv files and ogv files on disk regardless if the network is up and icecast streaming server reachable.

share|improve this question

1 Answer 1

You can probably do this with ordinary files if your don't need any concurrency at all. The principle for named pipes is the same

Change

foo | \
bar | \
baz

To

foo > foo.out
bar < foo.out > bar.out
baz < bar.out

If the *.out are named pipes then I suspect the programs writing to them may get blocked waiting for their output buffers to be drained.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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