lib-tcpdump-processing
lib-tcpdump-processing copied to clipboard
Implement an extraction of SRT DATA packets payload
Implement an extraction of SRT DATA packets payload, e.g., for extracting MPEG-2 TS from SRT packets and writing it in a file. An approach can be the following:
- Extract SRT DATA packets, sort them by sequence number and delete duplicates. Important to remember that SRT sequence number is updated in cycles. The seq.no of the very first packet is transmitted within the handshake. The maximum value correspond to 31bits.
- Extract payload of the DATA packets remaining after step 1 and write it consequently in a file. Important to remember that the payload maybe encrypted. In this case, it should be preliminary decrypted and then written in a file. The key can be extracted from the handshakes.
# Extract payload of SRT Data packets
# tshark -r "srt-stream.pcap" --disable-protocol udt -Y srt -T fields -e data.data -E separator=;
# Now use python to convert from ASCII to binary stream.
import binascii
import sys
string = open(sys.argv[1],'r').read()
sys.stdout.write(binascii.unhexlify(string)) # needs to be stdout.write to avoid trailing newline