Giter Club home page Giter Club logo

fifo's Introduction

This is fifo: a simple replacement for the shell pipe (|) with increased buffer size

Usage
-----

./fifo [-b bufsize] [-r readsize]
-b bufsize: set FIFO buffer size to bufsize bytes
-r readsize: read in blocks of readsize bytes

How does it work?
-----------------

fifo reads from stdin and writes everything it read to stdout
immediately, just as the pipe (|) operator. Its only advantage to pipe
is that it provides a configurable arbitrary sized fifo buffer. Its
disadvantage is that it works in user space, but this is a little price
to pay when the pipe would otherwise not provide enough buffering ;)

Why is it needed?
-----------------

There are many ways of connecting process I/O under UNIX, the most
common being the pipe (|) operator. Unfortunately, this operates with a
limited buffer size and blocking I/O. Thus, it creates a very tight
coupling between the two processes, blocking the feeder process when the
consumer can't digest all the data. This is fine in some cases, but not
in others.

This tight coupling can be a real pain for multimedia applications such
as ffmpeg, ffplay, vlc, mplayer, etc., where the feeder might provide
data in big chunks, and the consumer might block for long times while
trying to interpret the stream (e.g. figure out the format or the
codec).

Usage examples
--------------

Actually, fifo does not replace the pipe :), it has to be used with two
pipes as follows:

feeder | fifo | consumer

It can be used where applications have some nasty buffering behavior,
e.g. between dvbcat (that stalls on reception errors, then bursts after)
and ffmpeg (that might load the CPU too much to handle the burst).

dvbcat -P dvb-t "BBC" | fifo | ffmpeg -i - a.avi

fifo's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.