Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Certificate
This is certify that Project work, Media Streamer and Player a benefice work has been successfully carried out and submitted in the fulfillment of the requirement for the fifth semesters Bachelor of Engineering from ITM UNIVERSITY, during the academic year 2011-2012. It is certified that all correction / suggestion indicated for the internal Assessment have been incorporated in the Report. The Project report has been approved as it satisfied the academic requirement in respect of Minor Project work prescribed for the Bachelor of Technology and Engineering Degree. This project is done under the guidance of Mr. Ezaz Ahmed by Siddharth Sumit Thakran Tanmay Chaudhry Tarik Setia
Signature
(Course Co-ordinator)
Acknowledgement
The project you are holding is the result of dedication of Mr. Ezaz Ahmed under whose guidance ,We did such a great job of bringing and shepherding the project. This person always kept the things on track and helped us in getting the things in good shape. It was nice experience working with him. Lastly we wish to thank each and every person involved in making our project successful.
Table of Contents
1.Introduction 1.1 Overview of Media Streaming 1.1.1 Architecture of Media Streaming 2.Feasibility Study 2.1 Economical Feasibility Study 2.2 Technical Feasibility Study 2.3 Behavioral Changes Study 3.Technologies Used 3.1 Server Side 3.1.1 Transport Layer- UDP 3.1.2 Application Layer- RTP/RTSP 3.2 Client Side 3.2.1 Java Media Framework 4.Project Description 5.Requirement Analysis 5.1 Hardware Requirements 5.2 Software Requirements 6.System Requirement Specification 6.1 Server Side 6.1.1 External Interface Specification 6.1.2 Functional Specifications 7.Design 7.1 Server Side 7.1.1 Class Diagrams 7.1.2 Dependencies Diagram 7.2 Client Side 7.2.1 Class Diagrams 8.Snapshots 9.Conclusion 10.Future Scope 11.References
1.Introduction
Media Server
It all started in 1975 when a two networked TCP/IP communication was successfully tested between Stanford and University of London. After the success of TCP/IP the ARPNET migrated from its traditional way communication is Circuit Switching to TCP/IP. The migration of the ARPANET to TCP/IP was officially completed on flag January 1, 1983, when the new protocols were permanently activated. That day was the Foundation of Modern Internet. Back then internet was only supposed to transmit textual data over distances. But with development and successful implementation of various network and application layers the internet communication crossed the line of textual services and became what it is today, The Youtube, The Facebook etc where the every kind of media whether audio or video flows through the computer networks. This flow of media is called media streaming in which a host sends packets of data to the end user where all the packet are combined to form the media package. This project Terminal Media Server is the basic implementation of a media streaming server that use RTP as application layer and UDP as Transport layer. It also provides the feature of converting media formats falling under same categories. The next few section will go through the architectural and abstract technologies practiced to build this project.
Recently, Media player become popular in this generation. Most of the software companies develop so many types of player which support Multimedia files (e.g. Winamp, Window Media Player, Real, RealOne, etc). But there is not all of the software which are suitable for all different users. Our Java Media Player is basically a facility for music lovers to control playback of Multimedia files right from the local network. Also it can work as a standalone media system to run media files .We chosen java as the implementing language because java is platform independent so what will get can be run on any platform, following javas Write once run everywhere title. We built our media player with the help of Java Media player framework (JMF),we will discuss later about it in the Technology used section.
Client-Server Architecture
SERVER
CLIENTS
The clientserver model of computing is a distributed application that partitions tasks or workloads between the providers of a resource or service, called servers and service requesters, called clients. Often clients and servers communicate over a computer network on separate hardware, but both client and server may reside in the same system. A server machine is a host that is running one or more server programs which share their resources with clients. A client does not share any of its resources, but requests a server's content or service function. Clients therefore initiate communication sessions with servers which await incoming requests.
Peer-To-Peer
HUB
Peer to Peer (p2p) computing or networking is a distributed application architecture that partitions tasks or workloads among peers. Peers are equally privileged, equipotent participants in the application. They are said to form a peer-to-peer network of nodes. Peers make a portion of their resources, such as processing power, disk storage or network bandwidth, directly available to other network participants, without the need for central coordination by servers or stable hosts. Peers are both suppliers and consumers of resources, in contrast to the traditional client-Server model where only servers supply (send), and clients consume (receive).
2.Feasibility Study
A feasibility study could be used to test a new working system, which could be used because: The current system may no longer suit its purpose, Technological advancement may have rendered the current system redundant, The business is expanding, allowing it to cope with extra work load, Customers are complaining about the speed and quality of work the business provides, Competitors are now winning a big enough market share due to an effective integration of a computerized system. Within a feasibility study, six areas must be reviewed, including those of Economics, Technical, Schedule, Organizational, Cultural, and Legal.
3.Technologies Used
3.1 Server-Side - TMediaServer
3.1.1The Transport layer - UDP
The User Datagram Protocol (UDP) is one of the core members of the internet protocol suite, the set of network protocols used for the Internet. With UDP, computer applications can send messages, in this case referred to as datagrams, to other hosts on an internet protocol (IP) network without requiring prior communications to set up special transmission channels or data paths. DP uses a simple transmission model without implicit handshaking dialogues for providing reliability, ordering, or data integrity. Thus, UDP provides an unreliable service and datagrams may arrive out of order, appear duplicated, or go missing without notice. UDP assumes that error checking and correction is either not necessary or performed in the application, avoiding the overhead of such processing at the network interface level. Time-sensitive applications often use UDP because dropping packets is preferable to waiting for delayed packets, which may not be an option in a real-time system.If error correction facilities are needed at the network interface level, an application may use the TCP or Stream Control Transmission Protocol (SCTP) which are designed for this purpose.
The UDP header consists of 4 fields, each of which is 2 bytes (16 bits). The use of two of those is optional in IPv4 (pink background in table). In IPv6 only the source port is optional (see below).
This field identifies the sender's port when meaningful and should be assumed to be the port to reply to if needed. If not used, then it should be zero. If the source host is the client, the port number is likely to be an ephemeral port number. If the source host is the server, the port number is likely to be a well-known port number.
This field identifies the receiver's port and is required. Similar to source port number, if the client is the destination host then the port number will likely be an ephemeral port number and if the destination host is the server then the port number will likely be a well-known port number.
Length
A field that specifies the length in bytes of the entire datagram: header and data. The minimum length is 8 bytes since that's the length of the header. The field size sets a theoretical limit of 65,535 bytes (8 byte header + 65,527 bytes of data) for a UDP datagram. The practical limit for the data length which is imposed by the underlying IPv4 protocol is 65,507 bytes (65,535 8 byte UDP header 20 byte IP header).
3.1.2.2 RTSP
The Real Time Streaming Protocol (RTSP) is a network control protocol designed for use in entertainment and communications systems to control streaming media servers. The protocol is used for establishing and controlling media sessions between end points. Clients of media servers issue VCR-like commands, such as play and pause, to facilitate real-time control of playback of media files from the server. The transmission of streaming data itself is not a task of the RTSP protocol. Most RTSP servers use the RTP for media stream delivery, however some vendors implement proprietary transport protocols.
DESCRIBE
A DESCRIBE request includes an RTSP URL (rtsp://...), and the type of reply data that can be handled. The default port for the RTSP protocol is 554. This reply includes the presentation description. Among other things, the presentation description lists the media streams controlled with the aggregate URL. In the typical case, there is one media stream each for audio and video.
SETUP
A SETUP request specifies how a single media stream must be transported. This must be done before a PLAY request is sent. The request contains the media stream URL and a transport specifier. This specifier typically includes a local port for receiving RTP data (audio or video), and another for RTCP data (meta information). The server reply usually confirms the chosen parameters, and fills in the missing parts, such as the server's chosen ports. Each media stream must be configured using SETUP before an aggregate play request may be sent.
PLAY
A PLAY request will cause one or all media streams to be played. Play requests can be stacked by sending multiple PLAY requests. The URL may be the aggregate URL (to play all media streams), or a single media stream URL (to play only that stream). A range can be specified. If no range is specified, the stream is played from the beginning and plays to the end, or, if the stream is paused, it is resumed at the point it was paused.
PAUSE
A PAUSE request temporarily halts one or all media streams, so it can later be resumed with a PLAY request. The request contains an aggregate or media stream URL. A range parameter on a PAUSE request specifies when to pause. When the range parameter is omitted, the pause occurs immediately and indefinitely.
RECORD
The RECORD request can be used to send a stream to the server for storage.
TEARDOWN
A TEARDOWN request is used to terminate the session. It stops all media streams and frees all session related data on the server.
3.2 Client-Side
Java Media Framework(JMF)
The Java Media Framework (JMF) is a recent API for Java dealing with real-time multimedia presentation and effects processing.JMF handles time-based media, media which changes with respect to time. Examples of this are video from a television source, audio from a raw-audio format file and animations. The beta JMF 2.0 specification will be used for this report, as they currently reflect the features that will appear in the final version.
During the input stage, data is read from a source and passed in buffers to the processing stage.The input stage may consist of reading data from a local capture device (such as a webcam or TV capture card), a file on disk or stream from the network. The processing stage consists of a number of codecs and effects designed to modify the data stream to one suitable for output.These codecs may perform functions such as compressing or decompressing the audio to a different format, adding a watermark of some kind, cleaning up noise or applying an effect to the stream (such as echo to the audio). Once the processing stage has applied its transformations to the stream, it passes the information to the output stage.The output stage may take the stream and pass it to a file on disk, output it to the local video display or transmit it over the network. For example, a JMF system may read input from a TV capture card from the local system capturing input from a VCR in the input stage.It may then pass it to the processing stage to add a watermark in the corner of each frame and finally broadcast it over the local Intranet in the output stage.
4.Project Description
Project Functions
Playing an audio file Playing a video file Streaming an audio file Streaming a video file converting an audio file converting a video file
User
Characteristics
Any user from any actor group can use this software User must carry full administrator privileges. Software
Dependencies
Python Interpreter Twisted Matrix Libraries ffmpeg liberaries GStreamer Liberaries Ubuntu Operating System Java Media Framework Java Runtime Envt.
5. Requirement Analysis
5.1 Hardware Requirements
A computer with minimum following requirements. Minimum Processor Memory Video adapter and monitor Hard drive disk free space Devices Others 233MHz 64MB RAM Super VGA(800 x 600) 1.5GB Keyboard and mouse Sound card, speakers Recommended 300 MHz or higher 128 MB RAM or higher Super VGA (800 x 600) Or higher resolution 1.5 GB or higher Keyboard and mouse Sound card, speakers
NetBeans (an IDE for programming in java). JDK(Java Development Kit) 4 or better . Java Media Framework (JMF) API for developing media applications. Python Interpreter Twisted libraries for python. ffmpeg binding for python. Gstreamer toolkit.
User Interfaces
TMediaServer should provide user a way to interact with the
software. This can be done via UNIX Command Line Tool TERMINAL. TMediaServer may also provide a GUI for interaction
Hardware Interface
TMediaServer should be implemented on UNIX Platform. This
Software Interfaces.
No software interfaces except for the Python subsystem are
necessary.
7.Design
7.1 Server Side
7.1.1 Class Diagrams
datagramProtocol
RTPStreamer
sock seqNo invterval bufsize packetsSeny releaser peerAddress fileSize loadfile(filename) startProtocol() setBufferSize(bufsize) setPeerAddress(addr) setupStreaming(fileToPlay,buf,addr) startStreaming(fileToPlay,speed) continueStreaming()
RTSPMessage
rtspCommand URI pathname cseq bandwidth bufsize session speed rtspMsg tostring() fromstring() parse() parseURL()
Module:RTPServer.py
Module:RTSPMessage.py
Launcher
startUI() playMedia() streamMedia() transcodeMedia() exit()
Player
fileName player()
Converter
fileName convert()
Module:Launcher.py
Module:GPlayer.py
Module:FPlayer.py
lineReceiver
RTSPServer
messageHandler session currentSession data connectionMade() connectionLost(reason) lineRecieved() process() sendReply() describeRequest(msg) optionRequest(msg) setupRequest(msg) playRequest(msg) teardownRequest(msg);
Module:RTSPServer.py
SETUP
Init
TEARDOWN
Ready
TEARDOWN
TEARDOWN
PLAY
PAUSE
Pause
PLAY
Play
twisted.internet.protocol.datagramprot ocol
urlpars e
twisted.internet.ud p
url
re(regular
RTSPMess age
RTSPServer
twisted.internet.proto col
twisted.internet.lineRec eiver
GStreamer
ffmpeg Converter
Launcher
8.Snapshots
8.1 Client-Side
8.2 Server-Side
Home Screen
g: Main
fig:Pl
Transcode
fig:Tran
Data Stream
fig:Data
9.Conclusion
Working on this project was quite difficult as even till date project is partly complete. We really enjoyed this work because of the following reasons There is no book available on JMF and RTP/RTSP architecture so it was quite difficult to learn as we had to follow learn by work technique, originally been main motto at ITM. Got to know about optional APIs of java and python, it started understanding of their main utility , that is its expandability and being open source in nature. As even we kept this project as open source, many others will be using our code and they can make it better and complete. Learned how media files work and got to now internal file structure of MP3 file.
10.Future scope
Capture audio and video with your microphone and video camera, then store the data in a supported format. Process time-based media and change the content-type format. Transmit audio and video in realtime on the Internet. Live Broadcasting of College Lectures/Events. Video Conferencing. Broadcasting Media to Mobile Devices.
11.References
http://www.cs.columbia.edu/~hgs/rtp/ www.oracle.com/technetwork/java/javase/tech/index-jsp-140239.html http://www.twistedmatrix.com