TSDuck is an extensible toolkit for MPEG/DVB transport streams. TSDuck is used in digital television systems for test, monitoring, integration, debug, lab, demo.
This toolkit contains many variables, here we will currently focus on HLS streams re-direction to local Multicast UDP using the TSP tool
TSP, the transport stream processor
Usage: TSP <options> -I <input type> <source> -P <processing type> -O <output type> <target>
You can get detailed help on each module used:
tsp {-I|-O|-P} name –-help
Input Type:
- file : binary TS file
- hls : HTTP Live Streaming (m3u8)
- srt: Secure Reliable Transport
- dektec : Dektec ASI device
- dvb : DVB-S, DVB-T, DVB-C receiver devices
- ip : UDP/IP (unicast or multicast)
Processing Type:
There are over 50 types of Processing tools available for usage, in this example i'll be using the regular for the purpose of realtime re-streaming of source
Output Type:
- drop : drop packets
- file : binary TS file
- hls : HTTP Live Streaming (m3u8)
- dektec : Dektec ASI or modulator device
- ip : UDP/IP (unicast or multicast)
- play : render output using VLC, mplayer, xine, whichever is available
FILE input
Example: "C:\Program Files\TSDuck\bin\tsp" -I file <TS_file.ts> --infinite/repeat <number> -P regulate --pcr-synchronous -O ip 127.0.0.1:1000
In this example, we'll be using a local TS file as input and streaming it locally as a Unicast UDP
We can use the --infinite to create an endless loop of the input, or use --repeat <number> to loop a specific amount of times
Also here using -P regulate --pcr-synchronous to make sure the output will play as Realtime
HLS Input
In this example i'm using HLS input type and providing the URL source, and i've added option --live to indicate the source is a Live Stream.
then using the regulate
processing type to slow down the incoming feed so it will be fed into
the output at realtime (otherwise it will be read as fast as saving it
to a file)
Finally, using output to IP to generate a local Multicast UDP that can be used by VLC or Recorder
NOTE: Option "--live" is an Alias to "--start- segment -1" and changing the -1 to 0, 1, 2... will allow you to start the streaming not from the first chunk.
SRT Input
Example: "C:\Program Files\TSDuck\bin\tsp" -I SRT --caller IP:port -P regulate --pcr-synchronous -O ip -l <local IP address> 234.250.1.6:6000
In this example i'm using SRT input type and providing the URL source, and i've added option --caller to indicate TSP calls the source feed.
then using the regulate
processing type to slow down the incoming feed so it will be fed into
the output at realtime (otherwise it will be read as fast as saving it
to a file)
Finally, using output to IP to generate a local Multicast UDP that can be used by VLC or Recorder
DEKTEC Input
Example: "C:\Program Files\TSDuck\bin\tsp" -I dektec -c <port> -P regulate --pcr-synchronous -O ip -l <local IP address> 234.250.1.6:6000
In this example, we're using a DekTec ASI as the source for input and streaming it locally as a Multicast UDP to a specific local network address
To find which <port> we can use for the dektec source, we must first run the following command:
Example: "C:\Program Files\TSDuck\bin\tsdektec" -a -v
This command will list all DekTec cards available in the system and the inputs that can be used.
Then we output to IP and using the -l <local IP address> we will send the broadcasting to a specific network card to avoid overloading the network
ATSC/DVB Input
Example: "C:\Program Files\TSDuck\bin\tsp -I dvb --adapter 0 --frequency 206000000 -P regulate --pcr-synchronous -O ip -l <local IP address> 234.250.1.6:6000
In this example, we're using Hauppauge WinTV as the source input (or any other DVB/ATSC compatible adapter) and streaming it locally as a Multicast UDP similar to the DekTec ASI option. However, this requires additional setting of frequency as seen in the example above.
FILE Output
In this example, we are taking an HLS source and creating a local identical copy by dumping all contents into a TS file.
For this we are using the -O file <filename.ts> to specify we are using the file output plugin and then the target filename to be saved