File tree 4 files changed +55
-0
lines changed
4 files changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ FROM eyevinntechnology/ffmpeg-base:0.3.0
2
+ MAINTAINER Eyevinn Technology <
[email protected] >
3
+ COPY python/hls2srt.py /root/hls2srt.py
4
+ ENTRYPOINT ["/root/hls2srt.py"]
5
+ CMD []
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ The Eyevinn Toolbox is a set of Docker containers with tools that may come in ha
11
11
| Mosaic TS | Render a 2x2 or 3x3 mosaic in MPEG-TS from 4 or 9 HLS sources | eyevinntechnology/toolbox-mosaicts |
12
12
| HLS 2 TS | Pull a live HLS stream and output to multicast TS | eyevinntechnology/toolbox-hls2ts |
13
13
| HLS 2 RTMP | Pull a live HLS stream and re-stream to multiple RTMP destinations. | eyevinntechnology/toolbox-hls2rtmp |
14
+ | HLS 2 SRT | Pull a live HLS stream and transmit over SRT | eyevinntechnology/toolbox-hls2srt |
14
15
| SRT 2 RTMP | Receive an SRT stream and re-stream to multiple RTMP destinations. | eyevinntechnology/toolbox-srt2rtmp |
15
16
| RTMP 2 SRT | Receive an RTMP stream and transmit over SRT. | eyevinntechnology/toolbox-rtmp2srt |
16
17
@@ -279,6 +280,16 @@ Example:
279
280
docker run --rm eyevinntechnology/toolbox-hls2rtmp:0.1.3 HLSURL <RTMPURL1> <RTMPURL2>
280
281
```
281
282
283
+ ## Pull a live HLS stream and output to SRT
284
+
285
+ Use the ` hls2srt ` tool to pull a live HLS stream and make available over SRT.
286
+
287
+ Example:
288
+
289
+ ```
290
+ docker run -d --restart always -p 1234:1234/udp eyevinntechnology/toolbox-hls2srt:0.1.0 HLSURL 0.0.0.0:1234
291
+ ```
292
+
282
293
## Listen for an RTMP stream and output to SRT
283
294
284
295
Use the ` rtmp2srt ` tool to receive an RTMP stream and transmit over SRT.
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ docker build -t eyevinntechnology/toolbox-hls2srt:0.1.0 -f Dockerfile.hls2srt .
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/python2.7
2
+ #
3
+ # Copyright 2019 Eyevinn Technology. All rights reserved
4
+ # Use of this source code is governed by a MIT License
5
+ # that can be found in the LICENSE file.
6
+ # Author: Jonas Rydholm Birme (Eyevinn Technology)
7
+ #
8
+ # Receive HLS and stream over SRT
9
+ #
10
+ import argparse
11
+ import subprocess
12
+ from os .path import basename
13
+ import re
14
+ import glob
15
+
16
+ parser = argparse .ArgumentParser (description = 'Pull HLS and restream over SRT.' )
17
+ parser .add_argument ('hlsurl' )
18
+ parser .add_argument ('address' )
19
+ parser .add_argument ('--srtmode' , dest = 'srtmode' , help = 'SRT mode [caller|listener]. Default is listener' )
20
+ parser .add_argument ('--with-debug' , dest = 'debug' , action = 'store_true' )
21
+ args = parser .parse_args ()
22
+
23
+ srtmode = "&mode=listener"
24
+ if args .srtmode == "caller" :
25
+ srtmode = ""
26
+
27
+ srtoutput = "-f fifo -fifo_format mpegts -map 0:v:0 -map 0:a:0 -c copy srt://%s?pkt_size=1316%s" % (args .address , srtmode )
28
+
29
+ ffmpeg = "ffmpeg -fflags +genpts -re -i %s -strict -2 -y %s " % (args .hlsurl , srtoutput )
30
+
31
+ if args .debug :
32
+ print "%s" % ffmpeg
33
+ print ffmpeg .split ()
34
+
35
+ p1 = subprocess .Popen (ffmpeg .split ())
36
+ output ,err = p1 .communicate ()
You can’t perform that action at this time.
0 commit comments