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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
$Id: README 26 2009-10-20 18:44:22Z massiot $
Welcome to Multicat!
====================
The multicat package contains a set of tools designed to easily and
efficiently manipulate multicast streams in general, and MPEG-2
Transport Streams (ISO/IEC 13818-1) in particular.
The multicat tool itself is a 1 input/1 output application. Inputs and
outputs can be network streams (unicast and multicast), files, character
devices or FIFOs.
Multicat tries to rebuild the internal clock of the input stream; but
it wants to remain agnostic of what is transported, so in case of files
the said clock is stored to an auxiliary file (example.aux accompanies
example.ts) while recording. Other inputs are considered "live", and
the input clock is simply derived from the reception time of the packets.
IngesTS is a companion application designed to manipulate TS files. It
reads the PCR values of the file, and builds the auxiliary file that is
necessary for multicat.
OffseTS is another companion application to manipulate auxiliary files.
Given an offset in time from the beginning of the file, it returns the offset
of the position in number of packets.
Finally aggregaRTP and desaggregaRTP can be used to carry a high-bitrate
signal over several contribution links.
The multicat suite of applications is very lightweight and designed to
operate in tight environments. Memory and CPU usages are kept to a minimum,
and they feature only one thread of execution.
The socket description format
=============================
For conveniency all tools use the same way of describing a socket in a
program argument:
<connect address>:<connect port>@<bind address>:<bind port>
All parts are optional; default port (1234) or wildcard address will then
be used.
Some examples:
Reading all streams coming to port 5004:
@:5004
Reading from a multicast stream on port 5004:
@239.255.0.1:5004
The same, with source-specific multicast:
192.168.0.1@239.255.0.1:5004
Writing to a multicast stream on port 5004:
239.255.0.1:5004
The same, but binding to a specific interface:
239.255.0.1:5004@192.168.0.2
Using Multicat
==============
Recording a multicast address to a file:
multicat @239.255.0.1:5004 /tmp/myfile.ts
This will also create file /tmp/myfile.aux. Playing back the file:
multicat -p 68 /tmp/myfile.ts 239.255.0.2:5004
Adding an RTP header to an existing multicast stream:
multicat -p 68 -u @239.255.0.1:5004 239.255.0.2:5004
The PCR PID is here supposed to be 68. If you don't specify it, the timestamps
will not be RFC-compliant (but will work in most cases). You can use the
get_pcr_pid tool from libdvbpsi to determine it. Otherwise, if you are sure
the stream contains a single program, and only one PID carries a PCR, you can
pass "-p 8192" the disable the PID check. This isn't on by default because
it can produce awful things with multi-program transport streams, and the
world would be a better place if people had to knowingly turn it on.
Using IngesTS
=============
ingests -p 68 /tmp/afile.ts
This will create file /tmp/afile.aux. 68 is supposed to be the PCR PID.
The same note as above applies to ingesTS.
Playing the file:
multicat -p 68 /tmp/afile.ts 239.255.0.2:5004
Using OffseTS
=============
We want to take the first 60 minutes of a TS file. We must scale it in a
27 MHz clock:
60 * 60 (seconds) * 27000000 (MHz) = 97200000000
Find the offset in 1316-blocks:
offsets /tmp/myfile.aux 97200000000
It returns for instance "556896". Then cut the file using dd:
dd if=/tmp/myfile.ts of=/tmp/mynewfile.ts bs=1316 count=556896
Alternatively, if we want to *remove* the first hour:
dd if=/tmp/myfile.ts of=/tmp/mynewfile.ts bs=1316 skip=556896
It can also be done with multicat using the -s and -n options.
Using AggregaRTP and DesaggregaRTP
==================================
Splitting an RTP stream to two streams with different routing policies:
aggregartp @239.255.0.1:5004 239.1.0.1:5004@192.168.0.1 239.2.0.1:5004@172.16.0.1
At the other end, reassembling the two streams into one usable stream:
desaggregartp 192.168.0.1@239.1.0.1:5004 172.16.0.1@239.2.0.1:5004 239.254.0.1:5004
|