Revision 54b339eb

View differences:

README.md
7 7
https://ans.disi.unitn.it/redmine/projects/peerstreamer-ng/wiki
8 8

  
9 9
## Compilation
10
You can get the executable by running:
10
You need to install [Janus dependencies](https://github.com/meetecho/janus-gateway), on ubuntu:
11
```
12
aptitude install libmicrohttpd-dev libjansson-dev libnice-dev \
13
	libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev \
14
	libopus-dev libogg-dev libcurl4-openssl-dev pkg-config gengetopt \
15
	libtool automake
16
```
17

  
18
After that, you can get the executable by running:
11 19
``
12 20
$> make
13 21
``
......
24 32
$> make tests
25 33
``
26 34

  
27
## Example
28
You can run a test streaming network by following the example documentation [2]
35
## Tutorial: Stream a web camera with WebRTC
36
_Tested on Ubuntu 17.10_
37

  
38
In this tutorial we are creating a streaming source first, 
39
 * Acquiring a media content from a local (usb) camera;
40
 * Encapsulating it in a RTP stream;
41
 * Creating a pstreamer P2P overlay;
42
 * Injecting the RTP stream in the overlay.
43

  
44
Then, we will launch PeerStreamer-ng to serve the P2P stream to the user through a browser supporting WebRTC.
45

  
46
#### The source
47
The following script captures a usb camera (/dev/video0) with FFmpeg which is used to stream it locally through RTP.
48
It is important to note, to be able to serve the stream through WebRTC, FFmpeg must transcode the video with VP8.
49
It also launches a source instance of pstreamer that takes such stream in input and use P2P mechanism to distribute it to the attaching peers.
50

  
51
Overall, this script creates a _PeerStreamer-ng channel_ at IP address 127.0.0.1 on port 6000 and it saves its description on a local channel list file called _channels.csv_ which we will use to feed PeerStreamer-ng with.
52

  
53
```
54
NAME="My Channel"
55
VIDEO=/dev/video0
56
SDPFILE="file://${PWD}/channel.sdp"
57
SOURCE_PEER_PORT=6000
58
RTP_BASE_PORT=5002
59
HOST_EXT_IP=127.0.0.1
60

  
61
echo "$NAME,$HOST_EXT_IP,$SOURCE_PEER_PORT,QUALITY,http://$HOST_EXT_IP:8000/channel.sdp" > channels.csv
62

  
63
ffmpeg -re -i ${VIDEO} -vcodec libvpx -deadline realtime -an -f rtp rtp://127.0.0.1:$((RTP_BASE_PORT+2))\
64
	-sdp_file $SDPFILE &
65
FFMPEG_PID=$!
66

  
67
Libs/pstreamer/pstreamer -p 0 -c "iface=lo,port=$SOURCE_PEER_PORT,chunkiser=rtp,audio=$RTP_BASE_PORT,\
68
	video=$((RTP_BASE_PORT+2)),addr=127.0.0.1,max_delay_ms=50" 
69
SOURCE_PEER_PID=$!
70

  
71
trap "kill $SOURCE_PEER_PID $FFMPEG_PID" SIGINT SIGTERM EXIT
72
```
73

  
74
You can download [the script above](https://ans.disi.unitn.it/redmine/attachments/download/118/webrtp_source_camera.sh) from the project site.
75

  
76
#### PeerStreamer-ng
77

  
78
The following command executes PeerStreamer-ng and it start the HTTP interfaces.
79
Pages are now served on port 3000 (overridable through the flags, see the command line help).
80

  
81
```
82
./peerstreamer-ng -c channel.csv
83
```
29 84

  
30 85
## References
31 86
[1] https://ans.disi.unitn.it/redmine/projects/peerstreamer-ng
32
[2] https://ans.disi.unitn.it/redmine/projects/peerstreamer-ng/wiki/Streaming_a_live_camera

Also available in: Unified diff