This post sheds some light on possible reasons for deliberate corruption of the transport streams and demonstrates how useful it may be when performing testing and troubleshooting tasks.
Causing some deliberate problems
During TechCon, I talked about how we are opening up some tools to the world, and how some of these tools can be used for troubleshooting issues.
The demo scenario I talked about used the two inital Apache-licensed tools we’ve added to our GitHub pages.
In the presentation, I used a small Cinegy tool called NetSend to push a saved MPEG-2 Transport Stream (TS) file to my network. However, you can use something like Multicat (on Linux) or VLC on pretty much anything to generate a sensible stream. Or you can use any of our software that outputs IP. Or an actual device like an IP-enabled IRD or consumer box like an HDHomeRun.
Anyway, let’s assume you have a source of MPEG-2 TS data streaming around, and you want to muck around and corrupt it.
But Lewis, why would I corrupt my transport stream???
Testing requires that you check out situations that are not ideal, as well as situations working correctly. So if you are trying to test something that implements error correction, or you want to test that something that reads a TS can stand up to abuse, having a way to cause some problems that don’t involve waving things in front of your satellite dish LNB (don’t laugh, I’ve done that) can be really useful.
So let’s consider that we want to verify our validator tool sees errors, and that the Cinegy Player can read it (free trial here). Here’s the setup scenario here:
Once you download these tools, let’s assume that you’ve got a machine ready to go that can see a working multicast stream available in RTP available here: rtp://188.8.131.52:1234.
Pop open a console and type the following (you might need to change the -a parameter to point at your machine local IP address that receives the multicast):
TsAnalyser -m 184.108.40.206 -g 1234 -a 10.10.10.1
That done, you should see something like this:
So – that’s all working, and we have no errors! Yay! Let’s see if we can do something about that…
Open another console and get StreamGoo running in the middle of the chain and start it throwing some things away.
streamgoo -m 220.127.116.11 -g 1234 -n 18.104.22.168 -h 1234 -a 10.10.10.1 -b 10.10.10.1 -f 20 -t 4
This line is a bit more complex, but actually it’s pretty simple. It’s just listening like TsAnalyser (-m and -g options), but it has arguments indicating that the stream should be output to 22.214.171.124 (-n and -h options). It also has input / output adapters specified (-a and -b options). Finally, we tell it to apply a 'goofactor' (-f option) of 20 ‒ meaning roughly 20 in every 1000 packets will be corrupted ‒ along with a 'gootype' (-t option) of 4 ‒ meaning drop packets.
With this running, we can check what this does to the playing stream:
So we can see this is all nicely screwed up ‒ but what does the analyser show?
Excellent! We can see a load of lost packets! You might think this is a bit of a strange thing to have done, but as someone who has worked from some years troubleshooting and dealing with video over IP, there really is something to that phrase 'know your enemy'!