Adding MP3 module to the RTSP server

Kumar Saurabh
Columbia University
New York, NY
USA
saurabh@cs.columbia.edu

Abstract

Enhance the existing rtsp server to stream MP3 audio content.

Introduction

As is evident from the title, the goal of this project is to enhance the existing RTSP server to be able to stream mpeg audio as well. At the start of the project various audio formats like .wav and .au were supported.The Real-Time Streaming Protocol allows to control multimedia streams delivered, for example, via RTP. Control also includes absolute positioning within the media stream.

Background

To understand the design of the project, a familiarity with RTSP is essential. The Real Time Streaming Protocol (RTSP) is a client-server application-level protocol for controlling the delivery of data with real-time properties. The control stream allows various operations like seek, play, pause, close etc on the media stream. All such operations are real-time synchronized. For delivery of content various transport protocols like UDP and RTP(we will be using this) can be used.

Let us also go through some information about mpeg audio formats.Due to its quality MPEG audio has become very popular.An MPEG audio file is built up from smaller parts called frames. Generally, frames are independent items. Each frame has its own header and audio informations. There is no file header. Therefore, you can cut any part of MPEG file and play it correctly. This is only partially true for MPEG version 1 layer III, as frames can be interdependent.

The frame header is constituted by the very first four bytes (32bits) in a frame. The first eleven bits of a frame header are always set and they are called "frame sync". Therefore, you can search through the file for the first occurence of frame sync (meaning that you have to find a byte with a value of 255, and followed by a byte with its three most significant bits set. The frame header also gives information about sample frequency and bitrate which allows you to calculate the length of the frame in seconds. Header also stores information about the size of the frame. The information above is very sketchy and not very accurate, but it gives an idea about the format specification.

Architecture

The way RTSP server works is that it listens to the Clients on some specified port(specified on commandline when the server is started). It parses various requests and for different kind of media formats, it calls a set of media(rather format)-specific funtions. The project consisted of providing such callback functions for MP3 format.Some of these are presented below with a brief description of what they do :-

Program Documentation

The installation instructions for the rtspd remains unchanged aftre the addition of the module. As earlier, doing a "make rtspd" after downloading the source, builds the executable. No write/recording of mpeg stream is supported. The Web has been an excellent source of information for mp3 file information. One particularly useful site was http://ci1001892-a.sptnbrg1.sc.home.com/MP3/mpeghdr.htm

Measurements

Due to unavailability of free rtspd unicast mp3 players/clients, it was very difficult to do the testing for this module. However, we used the rtpdump program to dump the payload and the header and check if the content delivered was mp3 audio. For this a program called stripMp3 was used, which throws away the first four mp3 sudio-specific header from each payload packet. There seems to be some problem with the timestamps though.

Task List

The coding was done by Kumar Saurabh. I am extremely grateful to Kundan Singh and Prof. Henning Schulzrinne for being so helpful and patient with me.

References

1
Source of RFC 2250 and RFC 2326 along with the program rtpdump

Last updated: 15/02/2001 by Kumar Saurabh