You are on page 1of 11

BitTorrent Streaming

With Tribler
Software User Guide

Created By
David Childers

www.scvi.net

Sponsored By

 Broadcasting World

www.broadcastingworld.net
Creative Common License

Copyright July 2009, David Childers, unless otherwise stated.

This body of work is released under the Attribution­ShareAlike version 3.0, Creative Common License.

You may freely distribute or modify this work for commercial or non commercial purposes. 

If   you   choose  to   modify   this   work,   you   are   required   to   comply   with   the   Attribution­ShareAlike   version   3.0, 
Creative Common License requirements.

These requirements include:

­ You must attribute any derivatives of this work to David Childers.

­ If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, 
similar or a compatible license.

For the complete legal code, please refer here:
www.creativecommons.org/licenses/by­sa/3.0/legalcode
Index

­ Sponsors of the Tribler Software

­ Foreword

­ What Is BitTorrent Streaming

­ General Information

­ Implementation

­ The Economics of Peer­to­Peer Multimedia Delivery
Sponsors Of The Tribler Software

The P2P­Next integrated project consists of the following members:

AG Projects First Oversi
Haarlem, Netherlands Petach Tikva, Israel

British Broadcasting Corporation Pioneer Digital Design Centre Ltd
London, United Kingdom London, United Kingdom

DACC Systems RTV Slovenia – RTVSLO
Taby, Sweden Ljubljana, Slovenia

Technische Universiteit Delft  ­ TU Delft STMicroelectronics S.r.l.
Delft, Netherlands Agrate Brianza, Italy

Fabchannel The European Broadcasting Union  (EBU)
Amsterdam, Netherlands Geneva, Switzerland

Institut für Rundfunktechnik – IRT University of Klagenfurt
Munich, Germany Klagenfurt, Austria

Josef Stefan Institute University of Lancaster
Ljubljana, Slovenia Lancaster, United Kingdom

Kendra Foundation University of Rome
London, United Kingdom Rome, Italy

Kungliga Tekniska Högskolan – KTH University Politehnica of Bucharest
Stockholm, Sweden Bucharest, Romania

Markenfilm VTT – Technical Research Centre of Finland
Wedel, Germany Tampere, Finland

Norut
Tromsø, Norway

www.p2p­next.org

Research and Development Provided by: Financial Assistance Provided by:

Delft University of Technology Ministry of Economic Affairs of The Netherlands
www.tudelft.nl www.ez.nl

Vrije Universiteit Amsterdam Dutch Technology Foundation STW
www.vu.nl/en/index.asp www.stw.nl
Foreword

Peer­To­Peer content distribution has evolved from a simple method for individual file sharing to a complete 
system for continuous streaming media delivery.   There are many implementations of Peer­To­Peer streaming 
content delivery that exist, both open and closed source.  The most crucial factor for delivering continuous data 
streams in real time is guaranteed content delivery.

Tribler   is   based   on   the   most   documented   Peer­To­Peer   distribution   protocol.     Brahm   Cohen   developed   the 
BitTorrent   Peer­To­Peer   content   distribution   protocol   in   2001.     This   protocol   has   become   the   most   used 
application associated with Peer­To­Peer content distribution.  This protocol enables a very efficient method for 
guaranteed data delivery with low system overhead.

Mr. Cohen  developed this protocol  for the  distribution  of single files,  not continuous  streams  of data, which 


rendered the BitTorrent protocol unusable for the delivery of live multimedia streams.   The original BitTorrent 
protocol was later modified to allow the delivery of a continuous data stream, such as an Internet multimedia 
stream.

The delivery of rich multimedia content using the Internet in a cost effective manner requires broadcasters to 
work   smarter,   not   harder.   The   use   of  a   centralized   method   for   data   content   delivery   is  very   inefficient   and 
resource intensive.   Bandwidth that has been used for the delivery of data cannot be re­used.   The BitTorrent 
protocol can now be used for delivering both individual files and continuous data streams.

I would like to thank Scarlet Coker for providing assistance with the editing of the manuscript and to James 
Davey at Broadcasting World for allowing me the opportunity to create this handbook.

It is my sincere hope that the reader finds this guide a valuable resource.

Voce e minha inspiracao, querida Patricia.

        David Childers
         www.scvi.net
           July, 2009

        Sustaining Member

  
      Society Motion Picture
    and Television Engineers

'The time has come,' the Walrus said, 
'To talk of many things: 
Of shoes and ships and sealing wax
Of cabbages and kings
And why the sea is boiling hot
And whether pigs have wings.'

Lewis Carroll 
What Is BitTorrent Streaming

Internet   television   and   radio   stations   can   suffer   from   the   “Slash   Dot“   popularity   effect,   which   means   that 
broadcasters must cope with greater bandwidth demands due to more people receiving the Internet broadcast. 
Peer­to­Peer   multimedia   streaming   was   developed   to   alleviate   the   need   for   large   amounts   of   bandwidth   for 
Internet streaming to a global audience.   Without access to Peer­to­Peer content delivery, Internet Radio and 
Television stations are forced to use the inefficient and bandwidth intensive streaming technology.

There are many open and closed source Peer­to­Peer multimedia streaming applications available.   Several of 
these applications do not easily scale with traffic demands or they use inefficient peer distribution methods which 
can result in point­to­point data exchange failure.  Some of these applications also require complex installation 
and configuration, which is difficult for the less experienced computer user.  

What is BitTorrent ?

BitTorrent is an open source software application which was developed to distribute data files without requiring 
large amounts of bandwidth.  This software delivers the information by cutting files into smaller pieces and using 
a specialized Peer­to­Peer distribution process.  It does not require special configuration and is extremely easy to 
use.   The software is used extensively to distribute various types of content over the Internet.   Unfortunately, 
there are several drawbacks for using this software to deliver multimedia. This includes not being designed to 
distribute continuous streams of audio or video, which requires users to download an entire file before they can 
view or listen to it.

Improvements to BitTorrent that support real time multimedia streaming The European P2P Next organization 
and the Deft University of Technology in the Netherlands have developed several improvements to BitTorrent that 
allow   the   software   to   support   continuous   data   distribution,   such   as   audio   and   video   streaming.   These 
improvements incorporate a new process known as “Give To Get“, which focuses on having peers distributing 
content to neighboring clients using a special incentive process. Clients receive data based on the amount of data 
that they themselves send.  Information indicating the amount of data distributed by individual clients is gathered 
from surrounding peers and evaluated.  The ability to monitor the amount of data distributed by clients creates a 
incentive for all peers to actively participate in the exchange of data. The original BitTorrent distribution process 
known as “Tit For Tat” focused on peers exchanging data with neighboring clients that had previously done so.

These software improvements also include a modified method of data distribution priority. This method combines 
the processes of giving priority to rarest data chunks first and the sequential order of the data chunks.  Standard 
Bittorrent relies on giving priority to distributing the rarest chunks of data first.   This improvement allows the 
continuous flow of ordered data, which is important for Internet broadcast streaming.

Additional steps required for using BitTorrent real time multimedia streaming To provide continuous delivery of 
content,  the  encoded  multimedia must be  encapsulated using the  Transport Stream  communication protocol. 
This specialized protocol was created for the distribution of data that uses unstable environments for the transfer 
of data.  A Transport Stream is created by inserting additional time stamps into an existing data stream, which are 
placed at fixed intervals.  Any header information contained in the  multimedia stream, such as those found in 
video, are not used for content playback.

The Swarm Player is a modified BitTorrent client that is necessary to view or listen to the specially formated Peer­
to­Peer streaming multimedia. It uses the open source VLC media player; which is capable of using many audio 
and  video codecs,  in addition to  content encoded with various  multimedia container formats.    This  software 
operates  by  using  the Peer­to­Peer  improvements  for content redistribution.    The Swarm  Player is  a desktop 
application that does not require special configuration and is available for various computer operating systems.

BitTorrent Streaming incorporates the following steps:

­  Multimedia is encoded.
­  The encoded multimedia is passed to the Transport Stream encapsulation software.  
­  The encapsulated multimedia Transport Stream data is passed to the Bittorrent Stream creation software.
­  The BitTorrent Stream is passed to the Internet for distribution.
­  The end user receives the content using the Swarm Player.

Multimedia encoding is the first step in the streaming process.  Several audio and video codecs can be used for 
the encoding the content.  The list of codecs that can be used in the encoding process include: MPEG­1, MPEG­2, 
MPEG­4, H.264, Dirac, JPEG and Windows Media for video; in addition to MP1, MP2, MP3 , MP4, AC­3, LPCM , 
DTS for audio.  Audio, video or a combination of both, can be used for streaming; in addition to using live or pre­
recorded multimedia content.

The next step is to encapsulate the encoded multimedia, using the Transport Stream protocol.  The software used 
to encapsulate the encoded multimedia content must be capable of being used with both continuous data streams 
and individual data files.   This provides the ability to distribute either a multimedia stream or individual on 
demand files.

The final step is to use the Tribler software application for distribution of the multimedia content using BitTorrent 
Peer­to­Peer delivery.   This is an open source application that is available for various operating systems.   The 
Tribler   software   slices   up   the   encoded   multimedia   Transport   Stream   into   evenly   divided   data   chunks   and 
distributes them using the modified Peer­to­Peer delivery system.  It also creates a special torrent streaming file 
which allows people to click on the file and receive the multimedia content.

View on demand Creative Common multimedia content using Bittorrent Streaming. 

You   can   view   a   collection   of   Creative   Commons   on   demand   films   being   distributed   using   Tribler   Bittorrent 
Streaming located here : www.cs.vu.nl/~arno/vod

Conclusion

BitTorrent Streaming provides the ability to save bandwidth costs, using proven technology and can be deployed 
using   free   and   open   source   software   that   is   available   for   various   operating   systems.     Several   groups   have 
committed   substantial  monetary   grants  for  continued  development   of  this  Peer­to­Peer  multimedia   streaming 
application with the pledge of keeping the software improvements open source.

Peer­to­Peer streaming can provide greater distribution potential at lower costs for both video and audio content. 
Internet broadcasters will no longer be penalized for having popular stations and will no longer be forced to 
sacrifice multimedia quality for lower bandwidth use.  The age of the Micro Broadcaster is finally here.
General Information

The current Tribler version is able to perform continuous BitTorrent Streaming.

BitTorrent multimedia streams can be listed and searched for using the Tribler software search function.

Tribler users can search for BitTorrent multimedia streams in two ways.   Both methods use the search feature 
contained within the Tribler software GUI.

These include:
1. Asking other tribler peers that are connected to it.
2. Receiving it though random gossip.

The current version of Tribler can receive BitTorrent streams that are listed in the search.   Once the desired 
multimedia stream is found, the user can load the multimedia stream within the internal multimedia player and 
view it.

The Swarm Stream multimedia player software can be used to receive streams as well, however this software 
lacks the ability to search for content.

When choosing a name for the BitTorrent Stream, you should differentiate the content from standard multimedia 
files.  For example, in lieu of using the name of “Punk Rock” for a content stream, use the name of “Stream Punk 
Rock” to allow users to easily find continuously streamed content.

Please Note: 

The Video Lan Client is not capable of transcoding a NSV / Winamp Television stream.
Implementation

The  following  steps  must  be  taken   to   use   BitTorrent   Streaming   to   distribute   an   existing   Unicast   multimedia 
stream.

1. Install the Video Lan Client multimedia software.

2. Execute the Video Lan Client software.

3. Click the “File” tab. (Top left tab of the Video Lan Client software.)

4. Click the “Open Network Stream” tab.

5. Check “HTTP/HTTPS/FTP/MMS” option.

6. Enter the IP address and port number of the existing Unicast multimedia stream that you want to broadcast. 
Example:  http://45.258.87.102:6001

7. Check “Stream/Save” option.

8. Click “Settings” option.

Under Outputs

9. Check “Play Locally” option.

10. Check “HTTP” option.

Under Encapsulation Method

11. Check “MPEGTS”.

Under Transcoding Options

12. Select the appropriate video codec to transcode the multimedia to. (If transcoding is desired.)

13. Select the appropriate bitrate and scale if the video is transcoded. (Not required if video is not transcoded.)

14. Select appropriate audio codec to transcode the multimedia to. (If transcoding is desired.)

15.   Select   the   appropriate   bitrate   and   channels   if   the   audio   is   transcoded.   (Not   required   if   audio   is   not 
transcoded.)

16. Click “Ok” Twice.

Broadcasting

The   Video   Lan   Client   re­encodes   the   multimedia   content   using   the   Transport   Stream   (.TS)   protocol.     This 
communications protocol is required for BitTorrent Streaming. The Video Lan Client uses the IP address of the 
host   computer   for   the   HTTP   output   address   of   the   multimedia   Transport   Stream.     The   port   number   of   the 
multimedia Transport Stream is the same one used by the original Unicast multimedia stream. The HTTP address 
and port number are used by the Tribler software to fetch the rmultimedia Transport Stream source that has been 
re­encoded by the Video Lan Client.
1. Download the Tribler software source:
svn co http://svn.tribler.org/abc/branches/player­release­1.0

2. Install all required library dependencies as described in Tribler/readme.txt

3. Set the PYTHONPATH shell variable to the current directory
­ set PYTHONPATH=.  (windows)
­ export PYTHONPATH=. (Linux)

4. Run the Tribler broadcast software using the following command line parameters:
python   Tribler/Tools/createlivestream.py   ­­name   streamname.mpegts   ­­source   http://123.45.67.890:1234/ 
­­destdir . 

5. If the bitrate of the multimedia stream is different from the default of 512 kbps, it must be changed to reflect 
the true bitrate speed.  The command: ­­bitrate ### is used to adjust the bitrate setting to the correct speed.  The 
bitrate will be defined in bytes per second. If higher bitrates are used, it may be necessary to adjust the size of the 
data chunks  being distributed.  The size of the data chunks can be adjusted by using the command: ­­piecesize 
###.

6. The createlivestream.py script creates a file (example: stream_name.mpegts.tstream) that is similar to a torrent 
file.   This file can be used by the swarmplayer software to receive BitTorrent Stream.   The BitTorrent Stream 
torrent file can be embedded on a website as well.   This file is not nesessary for use with the actual Tribler 
software to receive a BitTorrent Stream.

Please Note:

The parameters of the generated .tstream file are not dependent on the actual multimedia content. A broadcaster 
can   reuse   the   same   .tstream   file   for   distributing   other   streams   at   various   times,  if  the   multimedia   stream 
parameters (bitrate, piecesize and/or stream name) are not changed. 

A special exemption for re­using the generated .tstream file is made for an authenticated stream, which is the 
default   setting   for   BitTorrent   Streaming.   The   generated   .tstream   file   will   only   remain   constant   if   the 
public/private keypair remains the same.   The multimedia stream parameters (bitrate, piecesize and/or stream 
name)   must   also   remain   the   same.   To   insure   that   the   public/private   keypair   remain   the   same,   the 
streamname.sauth file that is created when the software is initially run should not be deleted.

To   reduce   the   CPU   load   during   multimedia   content   playback,   a   broadcaster   can   disable   the   default   source­
authentication scheme.  This can be done using the Tribler/Tools/createlivestream­noauth.py script.

You can find additional information for streaming live local video feeds here:
www.tribler.org/trac/wiki/Tutorials/ExampleFeedSetups
The Economics of Peer­to­Peer Multimedia Delivery

Internet multimedia distributors must make technical preparations for the quantity of content to be delivered and 
for  the   projected   audience  size.     This  planning  is  necessary   to  ensure  there  are  adequate  network  resources 
available for the content distribution. The resource requirements for distribution can be determined by using the 
following formula: the number of concurrent audience participants expected to receive the data multiplied by the 
quantity of the data to be delivered equals the bandwidth needed for the distribution of the content. 

Bandwidth is the measurement of the quantity of data that can travel between two points in a specified time.  It is 
a resource that is not infinite and is controlled by several factors that include technical and hardware limitations 
that can restrict it's availability.  These limitations are due to the design and implementation of the network data 
transfer infrastructure. 

Lower bandwidth costs can provide greater network resources for content distribution, however, large amounts 
are still required to distribute high quality multimedia content to large numbers of people.  Smaller amounts can 
be allocated for content distribution for cost savings, which would result in the reduction of either the quality of 
the multimedia being delivered or limiting the number of people that can receive the content.   Large network 
resource requirements limit the ability of content distributors to provide a low cost solution to distribute content 
to a large audience size. 

Peer­to­Peer  content   delivery   allows  the   distribution   of  data   without   the  need   for  large  amounts  of  network 
resources   and   specialized   hardware.     Bandwidth   is   saved   by   sharing   network   resources   among   audience 
participants that receive the multimedia.   This allows the data to be distributed to large numbers of audience 
participants, which lowers the distribution cost of the content.  

Peer­to­Peer   data   transfer   is   designed   to   accommodate   very   large   numbers   of   participants   in   a   distribution 
network.  The only limitations for this method of content distribution are the proper configuration of the client 
software and taking into account the average available bandwidth within the distribution network.  This content 
delivery method can be used for both live or on demand multimedia content. 

The server / client distribution  model is very  inefficient and resource intensive. Centralized data distribution 


requires dedicated bandwidth for each audience participant receiving the content.   A content provider cannot 
exceed   the   bandwidth   limitations   of   the   network   server   used   for   content   distribution   without   degrading   the 
quality of the multimedia content.   Groups of network servers can be configured to adjust the bandwidth flow 
necessary for distributing content to large numbers of audience participants. A major issue with load balancing 
groups of servers is the additional expense for more hardware and network resources. 

Another economic factor is security issues.   Network servers are subject to such problems as denial of service 
attacks or data filtering.  Denial of service attacks can overload servers and render them unstable and unable to 
properly function.   Content or IP filtering can allow groups / institutions or governments to prevent audience 
members from accessing content deemed unsuitable, similar to the deliberate jamming of radio and television 
stations during the Cold War. 

The cost per listener will never substantially decrease with the server / client model, as opposed to the Peer­To­
Peer content delivery model.  The Peer­To­Peer distribution model can easily accommodate unlimited numbers of 
people and allow them to receive the multimedia content;  which will significantly lower the cost of multimedia 
distribution   through   the   conservation   of   network   resources.     Eliminating   the   need   for   network   servers   also 
reduces the overall cost per audience member by reducing the hardware requirements for content distribution.

You might also like