This page describes some P2P streaming software developed as examples and demos for the GRAPES library.
All the streamers implement an "epidemic" streaming protocol, typically based on a "push" strategy (every peer periodically sends a chunk to a neighbour).
In this first release, only video streams are supported and the chunkisation algorithm is currently very simple (1 chunk = 1 video frames). More complex and advanced chunkisation techniques will be integrated in the future.
The streamers are released under the GPL license; they are all based on GRAPES, which is released under the LGPL license.
Get the most recent release:
get dependencies with:
make prepare
compile with:
make
When compiling the streamer, some different options can be enabled/disabled as follows:
make FFDIR=<path to an ffmpeg build>
to compile a version of the streamer with a minimal libav-based
input module
make DEBUG=WhyNot
to compile a "debug" version of the streamer (prints out a lot
debug information, not really useful in practice unless you are
trying to hunt a bug)
make THREADS=YesPlease
to compile the multi-thread version of the streamer
make GRAPES=<path to your grapes>
to use a different build of GRAPES
The program runs either as a source or as a peer. The syntax is:
./dumbstreamer [-I <bind interface>] [-P <bind port>] [-i <known IP>] [-p <known port>] [-t <period>] [-c <chunks per second>] [-b <buffer size>]
Parameters and their [defaults]:
<bind interface>
: the network interface to bind to.
The IP address of this interface will be used in the node
identifier [eth0]
<bind port>
: the port on which the peer will listen
[6666]
<known IP>
: IP address of a known peer (generally, the
source). If not specified, a source is started. To start a peer,
specify the IP of the another peer that is already part of the
overlay (the source is an easy bet)
<known port>
: the port used by the known peer
<period>
: determines how often a chunk is sent
to a neighbourhood; defined in ms [500]
<chunks per second>
: maximum number of chunks sent
per second [4]
<buffer size>
: the size of the chunk buffer,
measured in chunks [8]
First, we suggest to test the non-libav-based version. This version generates "fake" text chunks, which are useful for debugging.
Build as above, but without ffmpeg support
make prepare; make FFDIR=
then, start a source:
./dumbstreamer -I lo
in a different shell, start a client:
./dumbstreamer -I lo -P 5555 -i 127.0.0.1 -p 6666
start another client:
./dumbstreamer -I lo -P 5556 -i 127.0.0.1 -p 6666
... Have fun! ...
Explanation: "-P " is the local port used by the client (6666 by default). Since we are testing source and multiple clients on the same machine, every client has to use a different port number. "-i " is the source IP, and "-p " is the port number used by the source.
After this testing, you can recompile with debug on, and/or with threads.
Compile a libav-based version (required only for the source peer). Then, prepare a (video-only) input file:
ffmpeg/ffmpeg -i <whatever.avi> -r 25 -an -vcodec mpeg4 -f m4v test.m4v
The input currently needs to be called "input.mpg", so
ln -s test.m4v input.mpg
Start the source. For the moment, you need to manually specify the rate
./dumbstreamer -I lo -t 40 -c 50
Start a client and a player:
./dumbstreamer -I lo -P 5555 -p 6666 -i 127.0.0.1 | ffmpeg/ffplay -
This work has been developed in the context of the Napa-Wine project.
Please contact luca.abeni at unitn.it or kiraly at disi.unitn.it with questions, comments, feedback, etc.