]> git.sesse.net Git - cubemap/blob - README
Create $(libdir) on make install.
[cubemap] / README
1 Cubemap is a high-performance, high-availability video reflector.
2
3 A short list of features:
4
5  - High-performance, through a design with multiple worker threads,
6    epoll and sendfile (yes, sendfile); a 2GHz quadcore can saturate
7    10 gigabit Ethernet (even with TLS) given a modern kernel.
8  - High-availability. You can change any part of the configuration
9    (and even upgrade to a newer version of Cubemap) by changing cubemap.config
10    and sending a SIGHUP; all clients will continue as if nothing had happened
11    (unless you delete the stream they are watching, of course).
12    Cubemap also survives the encoder dying and reconnecting.
13  - Support for setting max pacing rate through the fq packet scheduler.
14  - Reflects anything VLC can reflect over HTTP, even the muxes VLC
15    has problems reflecting itself (in particular, FLV). Can also
16    call out to external programs to receive or fetch streams in arbitrary
17    ways (e.g. through SRT), although of course they do not necessarily
18    have the same intrinsic high-availability reconfiguration support.
19  - Multicast support, both for sending and receiving (supports only protocols
20    that can go over UDP, e.g. MPEG-TS). Supports both ASM and SSM.
21  - TLS output support, through the TLSe library (requires libtomcrypt)
22    and the Linux kernel's kTLS (Linux 4.17 or newer). There are a few
23    limitations; see below.
24  - fMP4 (HLS) output support, generating playlists on-the-fly. Note that this
25    requires some extra metadata currently only set by Nageru (not VLC).
26  - IPv4 support. Yes, Cubemap even supports (some) legacy protocols.
27
28
29 HOWTO:
30
31   sudo apt install libprotobuf-dev protobuf-compiler libsystemd-dev libtomcrypt-dev pkg-config autoconf
32   sudo apt install libavformat-dev libavutil-dev  # Optional
33   autoreconf -I .
34   ./configure
35   make -j4
36
37 Cubemap does not in itself understand the format of video streams;
38 it requires HTTP input that is already delineated into headers and blocks,
39 so that it knows what parts of the stream to skip to clients that
40 connect after the stream has been. (The exception is self-synchronizing
41 streams with no headers, such as MPEG-TS. These can also be sent or
42 received over UDP) The input format is specific to Cubemap and is called
43 Metacube (technically, Metacube2, but Metacube1 is long gone and nothing
44 uses it anymore). Currently, you have three options to create Metacube
45 video streams: VLC, Nageru or FFmpeg with a hack.
46
47 For VLC, start the VLC encoder with the “metacube” flag to the http
48 access mux, like this:
49
50   cvlc [...] --sout '#std{access=http{metacube,mime=video/x-flv},mux=flv,dst=:4013/test.flv}'
51
52 Then look through cubemap.config.sample, copy it to cubemap.config,
53 compile and start cubemap.
54
55 Nageru, my free video mixer, can also produce Metacube streams natively,
56 and so can its included transcoder/remuxer Kaeru. See the manual
57 at https://nageru.sesse.net/doc/ for more information.
58
59 If you feel very adventurous, you can use LD_PRELOAD to load
60 ffmpeg_metacube_hack.so into an FFmpeg-using binary. (This is
61 experimental; native Metacube support is vastly preferred.)
62 For instance, here's one way you can use the ffmpeg(1) binary
63 to serve your webcam to Cubemap:
64
65   LD_PRELOAD=ffmpeg_metacube_hack.so ffmpeg -i /dev/video0 -f mpegts -listen 1 'http://[::]:9095'
66
67
68 To upgrade cubemap (after you've compiled a new binary), or to pick up new
69 config:
70
71   killall -HUP cubemap
72
73 Cubemap will serialize itself to disk, check that the new binary and config
74 are OK, and then exec() the new version, which deserializes everything and
75 keeps going.
76
77
78 Notes on TLS support:
79
80 Cubemap supports TLS on output, so that you can play video on TLS
81 web sites without issues with mixed content. TLS on input streams is
82 not (yet) supported.
83
84 TLS requires kTLS for both send and receive, ie., Linux >= 4.17 with CONFIG_TLS
85 enabled. Only cipher suites supported by kTLS is supposed, ie., AES-128-GCM
86 (if no such cipher suite is available, the connection will be aborted). If the
87 server is restarted before the key exchange for a connection is completed,
88 that connection will not survive the restart, unlike all other connections.
89 (This is a TLSe limitation.) You can have different certificates on different
90 ports (and have separate ports for TLS and non-TLS), but SNI is not yet
91 supported.
92
93
94 Munin plugins:
95
96 To activate these, symlink them into /etc/munin/plugins. If you don't put
97 the files in the expected default locations (as done by 'make install'),
98 you probably want some configuration in /etc/munin/plugin-conf.d/cubemap or
99 similar, like this:
100
101 [cubemap*]
102 user <something>
103 env.cubemap_config /etc/cubemap/cubemap.config
104 env.cubemap_stats /var/lib/cubemap/cubemap.stats
105 env.cubemap_input_stats /var/lib/cubemap/cubemap-input.stats
106
107
108 Legalese: 
109
110 Copyright 2013 Steinar H. Gunderson <steinar+cubemap@gunderson.no>.
111 Licensed under the GNU GPL, version 2. See the included COPYING file.
112
113 See tlse/LICENSE for TLSe licensing.