Presentation is loading. Please wait.

Presentation is loading. Please wait.

MPEG + RTP.

Similar presentations


Presentation on theme: "MPEG + RTP."— Presentation transcript:

1 MPEG + RTP

2 Previously, on CS5248 MPEG Compression
Sequence, GOP, Picture, Slice, Macroblock, Block, DC/AC Coefficient I-Frame, P-Frame, B-Frame NUS.SOC.CS5248 Ooi Wei Tsang

3 Previously, on CS5248 RTP headers
SSRC, Media Timestamp, Marker Bit, Payload Type .. Application-Level Framing NUS.SOC.CS5248 Ooi Wei Tsang

4 You are Here Encoder Decoder Middlebox Sender Receiver Network
NUS.SOC.CS5248 Ooi Wei Tsang

5 Application-Level Framing

6 Let the application decide, not protocol stacks.
How to send/recv? Let the application decide, not protocol stacks. Tennenhouse + Clark NUS.SOC.CS5248 Ooi Wei Tsang

7 Application Knows Best
How to reorder packets Whether to ignore loss Which packet to retransmit NUS.SOC.CS5248 Ooi Wei Tsang

8 Application Data Unit (ADU)
Can be processed individually, even out-of-order 8-Bit PCM audio: 1 ADU = 1 Byte MPEG1 Video: 1 ADU = NUS.SOC.CS5248 Ooi Wei Tsang

9 How to chop data into packets?
Every received packet should be useful (even in very lossy environment) Ideally, 1 ADU in 1 packet NUS.SOC.CS5248 Ooi Wei Tsang

10 RTP Payload Header MPEG-1? 2? Temporal Reference I? P? B?
RTP Header RTP Payload Header RTP Payload MPEG-1? 2? Temporal Reference I? P? B? Begin of Slice? End of Slice? NUS.SOC.CS5248 Ooi Wei Tsang

11 RTP Header Media Timestamp: 32 bits
the instant the first byte in this packet is captured 90 kHz timestamp (90000 = 1 second) NUS.SOC.CS5248 Ooi Wei Tsang

12 RTP Header Marker Bit: 1 if contains the last byte of a frame
NUS.SOC.CS5248 Ooi Wei Tsang

13 RTP Header 32 for MPEG-1 Payload Type: 7 bits NUS.SOC.CS5248
Ooi Wei Tsang

14 RTP Payload Header MBZ (5 bits) Unused. Must be 0 NUS.SOC.CS5248
Ooi Wei Tsang

15 RTP Payload Header T (1 bit)
1 if there is a MPEG-2 Extension Header after this header. NUS.SOC.CS5248 Ooi Wei Tsang

16 RTP Payload Header Temporal Reference (10 bits)
The ‘frame number’ of the current frame within the GOP NUS.SOC.CS5248 Ooi Wei Tsang

17 RTP Payload Header AN bit and N bit Set to 0 for MPEG-1 NUS.SOC.CS5248
Ooi Wei Tsang

18 RTP Payload Header S (1 bit)
Is there a sequence header in this packet? NUS.SOC.CS5248 Ooi Wei Tsang

19 RTP Payload Header BS (1 bit) and ES (1bit)
BS is 1 iff the ‘first’ byte of this payload is a slice header ES is 1 iff the last byte of this payload is the end of a slice NUS.SOC.CS5248 Ooi Wei Tsang

20 RTP Payload Header Picture Type (3 bits) I (1), P (2), B (3), D (4)
NUS.SOC.CS5248 Ooi Wei Tsang

21 RTP Payload Header Motion Vectors Information
Get from most recent picture header NUS.SOC.CS5248 Ooi Wei Tsang

22 Fragmentation Rules Sequence header: at the start of payload
GOP header: at the start of a payload (or follows Sequence header) Picture header: at the start of a payload (or follows Sequence/GOP header) NUS.SOC.CS5248 Ooi Wei Tsang

23 Fragmentation Rules A slice must be either
First data in the packet, or Follows integral number of slices A slice may be fragmented if exceeds the size of a packet NUS.SOC.CS5248 Ooi Wei Tsang

24 Packet Size 1 MTU is 1500 bytes IP Header UDP Header RTP Header
RTP Payload Header Payload Size = NUS.SOC.CS5248 Ooi Wei Tsang

25 Packetize MPEG-1 Video into RTP Packets
Project 1 Packetize MPEG-1 Video into RTP Packets

26 Goal Read MPEG-1 video, output RTP packets with proper: RTP headers
RTP payload headers fragmentation NUS.SOC.CS5248 Ooi Wei Tsang

27 Mnt (Media Networking Toy)
C++ Tcl/OTcl UNIX NUS.SOC.CS5248 Ooi Wei Tsang

28 Overview OTcl C++ MntData MntComponents NUS.SOC.CS5248 Ooi Wei Tsang

29 MntComponent recv(MntData *data) push(MntData *data) NUS.SOC.CS5248
Ooi Wei Tsang

30 MntPump Subclass of MntComponent No recv()
pump_some( ) { generate data push(data) pump_timer_.msched(time) } NUS.SOC.CS5248 Ooi Wei Tsang

31 Create and Link Components
set a [new MntA] set b [new MntB] $a add_link_to $b $a instproc on_stop_pumping {} { puts “done!” exit } $a start_pumping vwait forever NUS.SOC.CS5248 Ooi Wei Tsang

32 Important Classes MntComponent MntRTPFileWriter MntPump
MntRTPPayloadDumper MntRTPFileReader MntMPEGFileRTPizer NUS.SOC.CS5248 Ooi Wei Tsang

33 Important Classes MntData MntRTPMPEGPacket MntRTPHdr
MntRTPMPEGHdr NUS.SOC.CS5248 Ooi Wei Tsang

34 MntRTPMPEGPacket MntRTPHdr *rtp_hdr_; MntRTPMPEGHdr *pl_hdr_;
RTP Header RTP Payload Header RTP Payload MntRTPHdr *rtp_hdr_; MntRTPMPEGHdr *pl_hdr_; unsigned char *pl_data_; int pl_len_; NUS.SOC.CS5248 Ooi Wei Tsang

35 Example Tcl Scripts

36 Dealing with Bits BitStream A buffer buffer_ endDataPtr_ endBufPtr_
NUS.SOC.CS5248 Ooi Wei Tsang

37 Dealing with Bits BitParser Read bits from BitStream BitParser 1011101
NUS.SOC.CS5248 Ooi Wei Tsang

38 Basic Usage #include “mnt_bit_parser.h” #include “mnt_bit_stream.h”
BitStream *bs = new BitStream(“a.mpg”); BitParser *bp = new BitParser(); bp->wrap(bs); int x; Bp_GetInt(bp, x); NUS.SOC.CS5248 Ooi Wei Tsang

39 Dealing with MPEG Headers
MntMPEG1SeqHdr MntMPEG1GopHdr MntMPEG1PicHdr MntMPEG1SliceHdr NUS.SOC.CS5248 Ooi Wei Tsang

40 Basic Operations hdr->parse(bp) hdr->find(bp) hdr->skip(bp)
hdr->dump(bp1,bp2) NUS.SOC.CS5248 Ooi Wei Tsang

41 Example: MPEG Parsing

42 Project Homepage Descriptions Skeleton Code Mnt Documentation
IVLE Forums NUS.SOC.CS5248 Ooi Wei Tsang

43 Advice Use the source wisely Start early NUS.SOC.CS5248 Ooi Wei Tsang


Download ppt "MPEG + RTP."

Similar presentations


Ads by Google