Skip to main content

Easy understanding of RTP packets.

For any kind of real-time media transmission over internet it is mandatory to follow some specification. We know that the basic data that are transmitted over internet are UDP or TCP packet. Now the main fact is that how the data of specific (ICMP, RTP, RTCP ... etc) type  will transmit.


Now here we will talk about RTP packets.

The RTP --- means --  Real time transport protocol(as we all know!!!!)

The protocol details are given on rfc3550 .

RTP packets:

Q.1. How RTP Transmission packets are constructed ?
Q.2. What is the format of RTP packet ?
Q.3. Describe the RTP header.  

Q. 1. How RTP Transmission packets are constructed ?
Ans:  First of all RTP Transmission packets are not encrypted. They are the raw data of media encoder. For example a h264 encoder creates the raw data by taking input from any video media source and a G722 audio encoder creates the raw data by taking input from any audio source. These data are stored as payload  in a RTP packets without any encryption.  Now the most important part is how the data will arrange in a UDP/TCP packet so that network/any receiver will understand it as a RTP packet. For easy understanding we will take UDP transport for RTP packet and the codec will be x-vrtc1 (121) .


 An RTP transmission packet has 3 part for a successful transmission.

Part 1: IP (source and destination)
Part 2: Transmission protocol and port (source and destination)

Part 1 + Part 2  = 42 byte (UDP)

Part 3: RTP packets  (size depends on network MTU)


Q. 2. What is the format of RTP packet ?
Ans: In basic word it is just an equation.The equation is --

RTP = RTP-header (12-bytes) + RTP-Payload (n- byte).

In details it is like -- 

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |V=2|P|X|  CC   |M|     PT      |       sequence number         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                           timestamp                           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |           synchronization source (SSRC) identifier            |
   +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
 
 
 
 
First 12-bytes of a RTP packet is RTP-header.
The next n-bytes are RTP-Payload as data.


So now you know everything. Then , what is the crucial part ?
 The crucial part is that the -- Payload is divided into 2 part.

Payload = Payload - header + Payload - data.

Example:  h263 (34) Payload = 4 - byte Payload header + n - byte Payload data. 

If you miss to differentiate these 2 part most of the time your decoder will fail to decode the data.


 Q. 3. Describe the RTP header. 
Ans:   If you ask me I'll say there is nothing so hard that you need to describe.

1.  Version (v=2):  constant.

2.  Padding (p): how much data you need to ignore.

3.  Extension (X): Not so important to implement.

4.  CSRC count (CC): Important when some media profile specific extension are enforced. It is basically the info of media source. I mean the received packets or sending packets SRC info.

5.  Marker (M): Most important to identify a frame end. If it is 1 that means it is the last packet of a complete frame.

6. Payload Type (PT): which is used to determine the codec. For x-vrtc1 it is 121 and for h263 it is 34.

7. Sequence number: Differentiate one packet from other and maintain the sequence so that a receiver can create a complete packet.

8. Timestamp: Use to identify the delay between packets.

9. SSRC: Source Identifier which uniquely  identify the RTP packet for particular media line on a conference or a call.



That's all !!!!

You are good to go.




Comments

Popular posts from this blog

UDP server client in c

Server #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdio.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <stdlib.h> int main() {         int sock;         int addr_len, bytes_read;         char recv_data[1024],send_data[1024];         struct sockaddr_in server_addr , client_addr;         if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {             perror("Socket");             exit(1);         }         server_addr.sin_family = AF_INET;         server_addr.sin...

[ASTERIK] configure: error: *** uuid support not found (this typically means the uuid development package is missing)

ISSUE: Build error on Asterik , when you want test webrtc feature :) checking for uuid_generate_random in -luuid... no checking for uuid_generate_random in -le2fs-uuid... no checking for uuid_generate_random... no configure: error: *** uuid support not found (this typically means the uuid development package is missing) Fix: This issue arises due to missing of UUID generator specified by rfc4122 . +Linux sudo apt-get install uuid-dev  @Unix yum -y install libuuid-devel Asterik comes with lots of helpful script available on - asterisk/contrib/scripts/ folder of your ASTERIK source. So just use the following command on UNIX console to run the asterik pre-requisite script. contrib/scripts/install_prereq install And you are done! configuring. Now -- Make Asterik.

Video Conferencing Project in Java Source Code

My video conferencing project was completed as 300 project for 3rd year.It is not totally completed. There is some bug in here.To solve these bugs and to help other students this project is open.It is first try to make a project open source in this way so it can be modified.Any kind of question against this project will be answered. As this project was created in 3rd year 1st semester and now i nearly completed my BSc. so there will be little description about this.I will try to describe every class and function later when i get the chance.   For more details and how to build and run go to this link   in github.com . Latest code and binary release : VideoConference-v1.1 Older code and binary release : VideoConference-v1.0 Fix: 1. When in Video chat the Text chat option hanged for good. ################################################################################# FEATURE #############################################################################...