Mpegts Introduction
Mpegts Introduction
MPEG-TS
all you should know before using TSDuck
Version 9
Topics 2
• Service / Program
• DVB term : service
• MPEG term : program
• TV channel (video and / or audio)
• data service (software download, application data)
• Transport stream
• aka. « TS », « multiplex », « transponder »
• continuous bitstream
• modulated and transmitted using one given frequency
• aggregate several services
• Signalization
• set of data structures in a transport stream
• describes the structure of transport streams and services
MPEG-2 transport stream 5
PMT
service 1 streams video
audio 1
audio 2
transport stream subtitles 1
subtitles 2
service 2 streams ECM 1
ECM 2
TS packet 7
47
47
• Elementary stream = concatenation of all payloads of all TS packets with same PID
• Elementary stream transport
• packetization = cutting ES into packets payloads with same PID
setting Payload Unit Start Indicator (PUSI) in TS header on « unit » boundary
• multiplexing = mixing with packets from other PID’s to build a complete TS
• demultiplexing = extracting all packets with same PID from TS
• depacketization = rebuilding ES from packets payloads with same PID
using PUSI to resynchronize on « unit » boundary
Elementary stream :
packetization
TS packets :
depacketization
Elementary stream :
Packetized Elementary Stream (PES) 9
47 PCR 00 00 01 …
47
47 stuffing
• CA : CAT PID 17
Bouquet
BAT
• SI : Service Information Association
PID 1
PID 17 PID 17
CAT
• DVB-defined SDT SDT Service
• ETSI EN 300 468 Actual TS Other TS Description
terms EIT
Actual TS
EIT
Actual TS
EIT
Other TS Event
present / follow schedule present / follow
Information
schedule
PID 2 PID 20 PID 20
Extracted from
DVB standard
ETSI TS 103 197
DVB SimulCrypt head-end 24
• TSDuck plugins
• scrambler interacts with any standard ECMG
• datainject interacts with any standard EMMG or PDG
EMM signalization 25
CWG TS packet
message MUX /
random stream parity = odd 11 è transport_scrambling_control
Scrambler
AA .. .. AA CW = AA..AA
BB .. .. BB scrambled with « odd » CW
• Crypto-periods timeline
≈ 10 seconds
TS packet (t.s.c.) 11 10 11
time
Scrambling synchronization : receiver timeline 31
• Loose synchronization
• ECM’s may be missed
• CW transition is blurry (video & audio PID’s)
• No explicit synchronization between ECM’s and video/audio crypto-periods
• Typical usage
• 0x80 and 0x81 alternating with crypto periods
ECM table id change used as trigger by CA software to submit ECM to smartcard or TEE
ECM table id and CP number do not necessarily have the same parity
• 0x82 – 0x8F used for EMM’s
CAS-specific
typically one table id for each EMM type, easier to filter in STB
Access criteria transition 34
Extracted from
DVB standard
ETSI TS 103 197
Clear-to-scramble transition 35
Extracted from
DVB standard
ETSI TS 103 197
DVB CSA-2 36
• Operational issues
• hardware scramblers and descramblers use plain 64-bit keys
• CWG internally generates 64 random bits
• where is the entropy reduction applied ?
common chain : CWG? SCS?
scrambling chain : MUX? scrambler?
descrambling chain : ECMG? smartcard? CA software in STB? descrambler?
who knows if entropy reduction must be applied anyway?
Standards
our essential references
Essential standards 39
• MPEG
• ISO 13818-1, MPEG-2 system layer (TS, packetization, PSI)
transport stream è broadcast, blu-ray discs
program stream è DVD
• ISO
https://www.iso.org/standards.html
must be purchased
• DVB
http://www.etsi.org/standards
direct search : http://www.etsi.org/standards-search
allocated identifiers : http://www.dvbservices.com/identifiers/
• ITU
http://www.itu.int/ITU-T/recommendations/
H.xxx series : http://www.itu.int/rec/T-REC-H/
• IETF
https://tools.ietf.org/
• NIST
http://csrc.nist.gov/publications/
Audio and video standards and nicknames 41