summaryrefslogtreecommitdiff
path: root/README
blob: 6e9507c2ca0f157e40b12062ad6ef133171798cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
Server usage:
-------------

  $ ./stp-server

Runs on port 8000 by default. Further options can be seen with the --help flag:

  $ ./stp-server --help

The server supports multiple HTTP PUT streams and multiple RTP/UDP and HTTP GET 
streams for each PUT stream.

Usage with curl:
----------------
> Sending a stream (PUT) for only HTTP GET streaming:

  $ curl -v "http://localhost:8000/stream/[sessionid]?type=http" -T - < [video file]

This will use Chunked encoding and send the file in chunks.
Optionally, you can rate limit to emulate a live stream (--limit-rate)
Trying to create two streams on the same path will return a 409.

> Reading the webm output stream (GET):

  $ curl -v "http://localhost:8000/stream/[sessionid]" > [output file]

The server supports multiple PUT requests on different paths, and multiple GET
requests from these paths.

> Sending a stream (PUT) for only RTP-UDP streaming to 127.0.0.1:5004:

  $ curl -v "http://localhost:8000/stream/[sessionid]?type=rtp-udp&udp-clients=127.0.0.1:5004" -T - < [video file]

> Sending a stream (PUT) for both RTP-UDP and HTTP GET streaming:

  $ curl -v "http://localhost:8000/stream/[sessionid]?type=rtp-udp,http&udp-clients=127.0.0.1:5004" -T - < [video file]

> curl handles only HTTP, so there is no way to read the RTP-UDP stream using it


Usage with souphttp:
--------------------
> Sending a stream from a file (PUT) for only HTTP GET streaming:

  $ gst-launch-1.0 filesrc location=[video file] ! \
      souphttpclientsink location="http://localhost:8000/stream/[sessionid]?type=http"

This will use a persistent HTTP connection and Content-Length + Content-Range
headers to send the stream data.

> Sending a stream from a file (PUT) for only RTP-UDP streaming:

  $ gst-launch-1.0 filesrc location=[video file] ! \
      souphttpclientsink location="http://localhost:8000/stream/[sessionid]?type=rtp-udp&udp-clients=localhost:5004"

> Reading a webm output stream (GET):

  $ gst-launch-1.0 souphttpsrc location="http://localhost:8000/stream/[sessionid]" ! \
      filesink location=[some output file]

> Reading an RTP-UDP output stream:

  $ gst-launch-1.0 udpsrc host=127.0.0.1 port=5004 caps="application/x-rtp" ! \
      rtpvp8depay ! vp8dec ! videoconvert ! autovideosink

> Sending a stream from a file (PUT) for both RTP-UDP and HTTP GET streaming:

  $ gst-launch-1.0 filesrc location=[video file] ! \
      souphttpclientsink location="http://localhost:8000/stream/[sessionid]?type=rtp-udp,http&udp-clients=localhost:5004"

"udp-clients" is a comma-separated list of UDP host:ports to broadcast the RTP
stream to.

Token Validation:
-----------------
When the --token-server option is specified, only valid sessionids
("[sessionid]" in the above examples) are allowed to PUT or GET streams. In
addition, for RTP-UDP streams, the host and port must also be valid. These are
checked as soon as a client connects, so these tokens must be added to the
server's internal list before a client can connect to the server. See the
REST-API file for details about this.

If --token-server is not specified, token validation is disabled.