Streaming Media Server Setup Manual
Upcoming SlideShare
Loading in...5
×
 

Streaming Media Server Setup Manual

on

  • 3,429 views

Describe how to setup Darwin/VideoLAN/LIVE555/FFmpeg streaming media server. ...

Describe how to setup Darwin/VideoLAN/LIVE555/FFmpeg streaming media server.

The test target is MID(Mobile Internet Device) with Android Donut 1.6.

Also, it provide a method to add hints used in SDP for MP4 and 3GP media files.

Statistics

Views

Total Views
3,429
Views on SlideShare
3,409
Embed Views
20

Actions

Likes
1
Downloads
99
Comments
0

2 Embeds 20

http://willliw.blogspot.tw 19
http://willliw.blogspot.com 1

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Streaming Media Server Setup Manual Streaming Media Server Setup Manual Document Transcript

  • P.1 Streaming Media Server Setup Manual Version.3 William.L wiliwe@gmail.com 2009-09-25
  • P.2 Revision History Version Number Revision Date Comments 1st 2009-09-25 Create this document. 2nd 2009-10-12 Add topics : 1. Introduction to Real Time Stream Protocol 2.HTTP Streaming 3rd 2009-10-29 Add topics : 1. How To Setup Streaming Media Testing/Verifying Environment Successfully? 2. Streamable Media Files. 3. RTP Payload Type for Streaming Media.
  • P.3 Index Testing Environment.......................................................................................................................................... 5 How To Setup Streaming Media Testing/Verifying Environment Successfully?.......................................... 6 Streaming Servers .............................................................................................................................................. 7 1. VideoLan Client ..................................................................................................................................... 7 1.1. Supported Container Format for encoding ................................................................................... 7 1.2. Supported Network Protocol......................................................................................................... 8 1.3. Setup VLC as Streaming Server ................................................................................................... 8 1.4. Client Computer Setup................................................................................................................ 10 1.5. Android VLC Remote................................................................................................................. 12 2. LIVE555 Media Server........................................................................................................................ 19 2.1. Support Container Format for Encoding..................................................................................... 19 2.2. Support Network Protocol .......................................................................................................... 19 2.3. Setup ........................................................................................................................................... 19 3. DSS - Darwin Streaming Server ......................................................................................................... 21 3.1. Support Container Format for Encoding..................................................................................... 21 3.2. Support Network Protocol .......................................................................................................... 21 3.3. Setup ........................................................................................................................................... 21 3.4 Invoking DSS............................................................................................................................... 31 3.5 Important files and directories of the DSS................................................................................... 32 4. FFServer - FFmpeg Streaming server................................................................................................ 33 4.1 FFmpeg Configuration File ......................................................................................................... 33 4.2. Support Container Format for Encoding..................................................................................... 33 4.3. Support Network Protocol .......................................................................................................... 33 4.4. Setup ........................................................................................................................................... 34 5. Flumotion Streaming Server............................................................................................................... 38 5.1. Support Container Format for Encoding..................................................................................... 38 5.2. Support Network Protocol .......................................................................................................... 38 5.3. Setup ........................................................................................................................................... 38 Real-Time Streaming Protocol (RTSP).......................................................................................................... 48 HTTP Streaming .............................................................................................................................................. 49 To Create HTTP Streaming Video ............................................................................................................. 49 Limitations of HTTP streaming ................................................................................................................. 49 Comparison between Streaming and Progressive Downloading Media ..................................................... 50 Streamable Media File..................................................................................................................................... 51 1. MP4 ....................................................................................................................................................... 51 1.1. What is MP4?.............................................................................................................................. 51 1.2. MP4 file extensions..................................................................................................................... 52 2. How To Add Hint Track into MP4 & 3GP Files?.............................................................................. 52 2.1 MP4 Files .................................................................................................................................... 52
  • P.4 2.2 3GP Files ..................................................................................................................................... 52 RTP Payload Type for Streaming Media ....................................................................................................... 54 SHOUTcast – A Streaming Audio Tech.......................................................................................................... 55 References......................................................................................................................................................... 57 01. Video Lan............................................................................................................................................. 57 02. LIVE555 Media Server........................................................................................................................ 57 03. Darwin Streaming Server..................................................................................................................... 57 04. FFServer - FFMpeg Streaming Server................................................................................................. 57 05. Flumotion............................................................................................................................................. 57 06. To Add Ubuntu Universe and Multiverse Repository.......................................................................... 57 07. Stream Server Passing through NAT/Firewall..................................................................................... 57 08. Real-Time Streaming Protocol (RTSP)................................................................................................ 58 09. Session Description Protocol (SDP).................................................................................................... 58 10. Streamable Media Files........................................................................................................................ 58
  • P.5 Testing Environment Using「Ubuntu 8.04 Hardy Heron LTS」as our working operating system.
  • P.6 How To Setup Streaming Media Testing/Verifying Environment Successfully? 1. Use MediaInfo tool to identify what audio/video codec used by the media file going to be streamed. 2. Choose the correct streaming server supporting the file format and audio/video codec of that media file. 3. Confirm that media file is streamable (e.g. it has Hint Track information) if you want to use RTSP/RTP way to test streaming media. 4. Use the right media player with the capability to play streaming media. 5. Consider that network environment that if there has one or more NATs/firewalls between streaming server and media player. If it does, try to use HTTP streaming way using port 80.
  • P.7 Streaming Servers The followings are found open streaming servers. 1. VideoLan Client VLC media player which can be used as a server and as a client to stream and receive network streams. VLC is able to stream all that it can read. VLS (VideoLAN Server), which can stream MPEG-1, MPEG-2 and MPEG-4 files, DVDs, digital satellite channels, digital terrestial television channels and live videos on the network in unicast or multicast. Most of the VLS functionality can now be found VLC. Usage of VLC instead of VLS is advised. Here, we use VLC with streaming functionality as streaming server. 1.1. Supported Container Format for encoding Ogg with MPEG-1/ MPEG-2 ASF with MPGE-4 video MOV with MPGE-4 video MP4 with H.264/MPEG-4 AVC
  • P.8 1.2. Supported Network Protocol HTTP MMS RTP/UDP MMSH 1.3. Setup VLC as Streaming Server Step-01 : Install the following packages through APT tool on server and client computer. 1. VLC 2. VLC-plugin-esd 3. VLC plugin for Mozilla Open Synaptic (System -> Administration -> Synaptic Package Manager). In 「Settings -> Repositories」, make sure you have a「multiverse」repository activated. Command line : #> sudo apt-get update #> sudo apt-get install vlc vlc-plugin-esd mozilla-plugin-vlc Step-02 : Click 「檔案檔案檔案檔案 -> 開啟檔案開啟檔案開啟檔案開啟檔案」 Show off the “開啟檔案開啟檔案開啟檔案開啟檔案…” dialog :
  • P.9 Step-03 : In「開啟開啟開啟開啟:」item, to select the video or audio files you wish to playback. Step-4 : Check「快取快取快取快取」 Check「串流串流串流串流/儲存儲存儲存儲存」 Click 「設定設定設定設定」button. Step-5 : Check「Play Locally」so that you can see and hear the output. Check「RTP」to play over a LAN. Fill in Host IP address in「位置位置位置位置」field of RTP item.
  • P.10 Step-06 : Click「確定確定確定確定」 1.4. Client Computer Setup Step-01 : Invoke VLC. Click「媒體媒體媒體媒體 -> 開啟網路串流開啟網路串流開啟網路串流開啟網路串流.」 Step-02 : Select「RTP」from the “Protocol” column. You can leave the address section blank.
  • P.11 Step-03 : Click「Play」to start to play streaming video.
  • P.12 1.5. Android VLC Remote This application works as a「Remote Control」to control VLC.
  • P.13 Step-01 : Download「android-vlc-remote-0.2.2.apk」. Step-02 : Install「android-vlc-remote-0.2.2.apk」using ADB. Step-03 : In the device installed Android, executing Android-VLC-Remote application. It appears as the following : To maximize the VLC display window To view played media file list. To browse the filesystem on VLC
  • P.14 The list showing media files had been played. It can browse server’s filesystem. Click mouse left button to show “Setting” interface to set the VLC server’s IP address and port (The default port number is 8080) :
  • P.15
  • P.16 Step-04 : In VLC player, click 「設定設定設定設定->偏好偏好偏好偏好設定設定設定設定」to open 「偏好偏好偏好偏好設定設定設定設定」dialog : Click the「界面界面界面界面」item Check the lower-right’s「進階選項進階選項進階選項進階選項」
  • P.17 Fill your「Host address」where the VLC server installed. Step-05 : In VLC player, click「設定設定設定設定->新增界面新增界面新增界面新增界面->Web Interface」 Now, Android-VLC-Remote can connect to VLC player.
  • P.18 The following is the snapshot of packet capture of communication between Android-VLC-Remote and VLC player. The Host containg VLC player is “192.168.0.132” and the Android device is “192.168.0.175” : Android-VLC-Control send HTTP-Requests for “playlist.xml” and “status.xml” per second. [Tips] 1. You can stream using this method over the Internet relying on the HTTP protocol instead of RTP. Make sure both the client and host have the appropriate ports open on their firewalls. 2. To stream effectively, the client must have all the audio and video codecs present on the host. If they do not, VLC can use transcode to convert the file into something the client can play. 3. UDP streaming methods require MPEG TS encapsulation. The HTTP streaming method can be used with the MPEG PS, MPEG TS, MPEG 1, OGG, RAW or ASF encapsulation.
  • P.19 2. LIVE555 Media Server 「LIVE555 Media Server」is a complete RTSP server application. 2.1. Support Container Format for Encoding AAC AMR MP3 MPG WAV 2.2. Support Network Protocol RTSP ( default port : 8554 ) 2.3. Setup Step-01 : To install the following packages through the APT tool : 1. liblivemedia-dev 2. livemedia-utils
  • P.20
  • P.21 3. DSS - Darwin Streaming Server Darwin Streaming Server is an open source project intended for developers who need to stream QuickTime and MPEG-4 media on alternative platforms such as Windows, Linux, and Solaris Darwin Streaming Server is only supported by the open source community and is not eligible for technical support from Apple. Darwin Streaming Server is available as a free download under the Apple Public Source License. 3.1. Support Container Format for Encoding QuickTime MPEG-1 MPEG-2 MP4 3.2. Support Network Protocol HTTP ( default port : 80 ) RTSP ( default port : 554 ) RTP RTCP 3.3. Setup Step-01 : sudo apt-get update && sudo apt-get upgrade Step-02 : sudo apt-get install build-essential Step-03 : sudo addgroup --system qtss Step-04 : sudo adduser --system --no-create-home --ingroup qtss qtss Step-05 : Download the latest version at http://static.lstoll.net/dss/DarwinStreamingSrvr6.0.3-Linux.deb.gz , and put the download “DarwinStreamingSrvr6.0.3-Linux.deb.gz” into a directory you like. Step-06 : tar -xvf DarwinStreamingSrvr6.0.3-Linux.deb.gz Step-07 : sudo dpkg -i DarwinStreamingSrvr6.0.3-Linux.deb
  • P.22 The default login account and password
  • P.23 The above two console snapshots show the prograss of Darwin installation. Step-08 : If you see Setup Complete! message, you are good to go. Logon to http://ServerName:1220/ using your browser. Username and password is “admin” and “admin”, respectively as the following figure.
  • P.24 Step-09 : First logging, the user will be requested to set some configuration as the following figures. <I> Specify a MP3 Broadcast password..
  • P.25 <II> This will enable encryption between the administration server and the web client.
  • P.26 <III> Specify the location of your media folder. By default this is /usr/local/movies/”.
  • P.27 <IV> To allow streaming on port 80 (the same as Apache), then check the box. Click on "Finish" to end the configuration.
  • P.28 Once you have finished configuring your streaming server, you will see the following page, which is a snapshot of your streaming server, and the administrative control panel of your streaming server :
  • P.29 In main page, you could change configures. (1). The「General Settings」page. It can let user to change “Media Directory” or change administrator’s password.
  • P.30 (2). To enable the port for passing through firewall/NAT.
  • P.31 The following figure shows pre-installed testing video files under「Media Directory」: 3.4 Invoking DSS In console, to execute this command : sudo /usr/local/sbin/DarwinStreamingServer
  • P.32 To check if DSS is invoked, executing following commands : netstat -ntulp | grep 554 and ps -aux | grep Darwin 3.5 Important files and directories of the DSS /usr/local/sbin/Darwin Streaming Server ---- Server Software /usr/local/sbin/streamingadminserver.pl ---- Web Frontend /etc/streaming ---- Configuration Dir /etc/streaming/streamingserver.xml ---- Configuration File Server /var/streaming/logs ---- Logs /usr/local/movies ---- Default directory for video files Then, the file /etc/streaming/streamingserver.xml must be given write privledges, otherwise no configuration can be saved : #> sudo chmod 755 /etc/streaming/streamingserver.xml
  • P.33 4. FFServer - FFmpeg Streaming server The FFmpeg project is made of several components: ffmpeg is a command line tool to convert one video file format to another. It also supports grabbing and encoding in real time from a TV card. ffserver is an HTTP (RTSP is being developed) multimedia streaming server for live broadcasts. Time shifting of live broadcast is also supported. ffplay is a simple media player based on SDL and on the FFmpeg libraries. libavcodec is a library containing all the FFmpeg audio/video encoders and decoders. Most codecs were developed from scratch to ensure best performance and high code reusability. libavformat is a library containing demuxers and muxers for audio/video container formats. libavutil is a helper library containing routines common to different parts of FFmpeg. libpostproc is a library containing video postprocessing routines. libswscale is a library containing video image scaling routines. FFserver receives prerecorded files or FFM streams from some ffmpeg instance as input, then streams them over HTTP/RTSP/RTP. An ffserver instance will listen on some port as specified in the configuration file. You can launch one or more instances of ffmpeg( FFmpeg video converter ) and send one or more FFM streams to the port where ffserver is expecting to receive them. Alternately, you can make ffserver launch such ffmpeg instances at startup. 4.1 FFmpeg Configuration File Input streams are called feeds, and each one is specified by a <Feed> section in the configuration file. For each feed you can have different output streams in various formats, each one specified by a <Stream> section in the configuration file. 4.2. Support Container Format for Encoding AVI ASF FLV SWF(Macromedia Shockwave Flash) Matroska MPEG-TS 4.3. Support Network Protocol HTTP (default port : 8090) RTSP (default port : 5454) UDP RTP
  • P.34 4.4. Setup Step-01: Install “ffmpeg” package using APT. After installing “ffmpeg” package, you can use “ffserver” and “ffmpeg” commands under console. Step-02 : Furthermore, to finish streaming configuration. <I> HTTP Streaming The following is an example of setting HTTP streaming :
  • P.35 [Feed Section] [Stream Section] After writing Ffserver configuration file, execute the commands : #> ffserver -f /DirectoryContainingConfigurationFile/ffserver.conf & #> ffmpeg -i /home/william/QAD-media-files/test.mpg http://localhost:8090/feed1.ffm <II> RTSP Streaming <Feed feed1.ffm> # You can specify the maximum size of the feed, # where zero means unlimited. Default: FileMaxSize 200K # Only allow connections from localhost to the feed. ACL allow 127.0.0.1 </Feed> <Stream test1.mpg> # coming from live feed 'feed1' Feed feed1.ffm # Format of the stream Format mpeg # Bitrate for the audio stream. Codecs usually support only a few # different bitrates. AudioBitRate 32 # Number of audio channels: 1 = mono, 2 = stereo AudioChannels 1 # Sampling frequency for audio. When using low bitrates, you should # lower this frequency to 22050 or 11025. The supported frequencies # depend on the selected audio codec. AudioSampleRate 44100 # Bitrate for the video stream VideoBitRate 64 # Ratecontrol buffer size VideoBufferSize 40 # Number of frames per second VideoFrameRate 3 # Size of the video frame VideoSize 160x128 </Stream>
  • P.36 The following is an example of setting RTSP streaming : Step-03 : Client setup for [HTTP] http://FFserverIP:8090/test1.mpg [RTSP] rtsp:// FFserverIP:5454/test1-rtsp.mpg The filename in URL is the one specified in <stream> tag. Step-04 : FFserver supports an HTTP interface which exposes the current status of the server. Simply point your browser to the address of the special status stream specified in the configuration file. For example if you have : then the server will post a page with the status information when the special stream status.html is requested as the following figure : # RTSP examples # You can access this stream with the RTSP URL: # rtsp://localhost:5454/test1-rtsp.mpg # A non-standard RTSP redirector is also created. Its URL is: # http://localhost:8090/test1-rtsp.rtsp #RTSPPort 5454 <Stream test1-rtsp.mpg> Format rtp File "/home/william/QAD-media-files/test1.mpg" </Stream> <Stream status.html> Format status # Only allow local people to get the status ACL allow localhost ACL allow 192.168.0.0 192.168.255.255 </Stream>
  • P.37 [Tips] 1. When you connect to a live stream, most players (WMP, RA, etc) want to buffer a certain number of seconds of material so that they can display the signal continuously. However, ffserver (by default) starts sending data in realtime. This means that there is a pause of a few seconds while the buffering is being done by the player. The good news is that this can be cured by adding a '?buffer=5' to the end of the URL. This means that the stream should start 5 seconds in the past --and so the first 5 seconds of the stream are sent as fast as the network will allow. It will then slow down to real time. This noticeably improves the startup experience. You can also add a 'Preroll 15' statement into the ffserver.conf that will add the 15 second prebuffering on all requests that do not otherwise specify a time. In addition, ffserver will skip frames until a key_frame is found. This further reduces the startup delay by not transferring data that will be discarded. 2. You may want to adjust the MaxBandwidth in the ffserver.conf to limit the amount of bandwidth consumed by live streams. The streams specified in configuration file using <>
  • P.38 5. Flumotion Streaming Server Flumotion is a streaming server product developed by Fluendo, and is written in Python and based on the multimedia framework Gstreamer and Twisted. Flumotion hastwo forms of streaming content: Live streaming and On-Demand streaming. For instance, a radio station might want to broadcast their audio live over the Internet, simultaneously as it is broadcast via FM radio. However, that same radio station might like to provide ondemand access to the archive of their recorded content. It can from Ogg / Vorbis / Theora files. 5.1. Support Container Format for Encoding ASF QuickTime Ogg OGM Matroska MP4 5.2. Support Network Protocol HTTP 5.3. Setup When it is going to Flumotion as a multiformat streaming server, it will need at least「gst-plugins-base 0.10.25」,「gst-plugins-good 0.10.17」and「gst-plugins-bad 0.10.14」, some of which are yet due to be released. Step-01 : For Ubuntu Hardy, to add the following line into APT source list file,「/etc/apt/sources.list」: deb http://www.flumotion.net/pkg/ubuntu hardy main Step-02 : To install flumotion, type the following commands : apt-get update && apt-get install flumotion Step-03 : Install Flumotion using APT
  • P.39 Step-04 : Add yourself to the flumotion group: sudo adduser <Username> flumotion Step-05 : Make the /etc/flumotion directory readable: sudo chmod a+x /etc/flumotion Step-06 : In the configuration file, add the following tag for streaming files. When it progress installation, it may show the window to ask the user input some data to create a certificate for SSL. <component name="loop-producer-high" type="loop-producer" worker="demo1-looper"> <property name="framerate">25/2</property> <property name="height">284</property> <property name="width">352</property> <property name="location">/srv/flumotion/moto.ogg</property> </component>
  • P.40
  • P.41
  • P.42
  • P.43 Step-06 : To start Flumotion, choose the 「Application -> Sound & Video -> Flumotion Streaming Server Administration」 menu item on your panel. : Starting the Configuration Assistant
  • P.44 Start to connect to Flumotion Manager Starting a new Manager and Worker
  • P.45 The Configuration Assistant's Production Page, Showing Test Inputs We don't need to change anything on the remaining pages, so you can now continue to click Forward until you reach the last page. You will pass pages for Test Video Producer settings, Overlay settings, Test Audio Producer settings, Encoding settings, Theora Encoder settings, Vorbis Encoder settings, Consumption settings (streaming or saving to disk), HTTP Streaming settings, HTTP Streaming (Audio & Video) settings, Content License settings, and then the Summary page.
  • P.46 The Administration Window
  • P.47 Connected Users Status [Tips] 1. For streaming files, not all file formats can be streamed on demand, because they require client players to download the entire file to obtain enough information for the client to start playing. For instance, files using the AVI container (usually with an .avi extension) cannot be streamed on demand.
  • P.48 Real-Time Streaming Protocol (RTSP) The Real-Time Streaming Protocol (RTSP) is an application-level protocol, and establishes and controls either a single or several time-synchronized streams of continuous media such as audio and video. RTSP does not typically deliver the continuous streams itself; the delivery mechanisms are based solely on RTP. No file will be saved in the disk of end user. The streamed media will be played back on the fly when it reach the remote end through network. The idea in RTSP is that it acts as a "network remote control" for multimedia servers. RTSP URL is in form「rtsp://media.example.com:554/twister/audiotrack」, where * rtsp:// is the identifier for TCP rtsp scheme (rtspu:// is used for UDP scheme) * 554 is the assumed port(default port) for Real-Time Streaming Protocol * twister is the name of the presentation * audiotrack is the name of certain stream in the presentation (this is optional) RTSP supports the following features : RTP packets can stream over UDP or over TCP. If the client can tolerate packet loss, streaming over UDP can be more efficient than TCP because UDP does not incur the overhead of retransmitting lost packets. The encapsulation of Advanced Streaming Format (ASF) packets in RTP is proprietary. Streaming with RTSP fails if a firewall separates the client and server, and the firewall blocks the ports and protocols that RTSP uses. This problem is especially common with home Internet gateways. Even if the gateway has a built-in RTSP NAT, streaming might fail at times. RTSP has the overhead of requiring multiple requests before playback can begin. However, the client can pipeline many of these requests and send them over a single TCP connection, in which case WMP does not need to block waiting for a response. The biggest issue with RTSP is that the protocol or its necessary ports may be blocked by routers or firewall settings, preventing a device from accessing the stream. As the standard protocol for the Web, though, HTTP is generally accessible [Ref.].
  • P.49 HTTP Streaming This is the simplest and cheapest way to stream video from a website. This way is also called「Serverless Streaming」or「Pseudo Streaming」. When a media file is playing, it is progressively downloading media file via HTTP. To Create HTTP Streaming Video 1. Create a video file in a common streaming media format. 2. Upload the file to your web server. 3. Make a simple hyperlink to the video file, or use special HTML tags to embed the video in a web page. Limitations of HTTP streaming 1. HTTP streaming is a good option for websites with modest traffic, i.e. less than about a dozen people viewing at the same time. For heavier traffic a more serious streaming solution should be considered. 2. You can't stream live video, since the HTTP method only works with complete files stored on the server. 3. You can't automatically detect the end user's connection speed using HTTP. If you want to create different versions for different speeds, you need to create a separate file for each speed. 4. HTTP streaming is not as efficient as other methods and will incur a heavier server load.
  • P.50 Comparison between Streaming and Progressive Downloading Media Q : What is the difference between streaming video and making video available for progressive download? Which is preferred? A : * The basic difference between streaming video and making it available for progressive downloads is the server used to deliver the content, the time it takes to deliver the content and whether or not a copy of the content stays on the user's machine. * When video is streamed, it is delivered from a streaming media server and is played on the computer using a particular piece of software, such as Windows Media, Real Player or Quicktime. This all occurs rapidly (depending on the speed of the Internet connection and the user's processor). The file remains on the server and is not transferred to the viewer's computer. Events can be streamed live and / or can be archived for later viewing. The url for files hosted on media server may begin with rtsp:// or mms://. * If a file is made available for progressive download, a copy of the file is transferred to the user's computer. The viewer may in some cases begin to start viewing it when the download begins, but will not be able to fast forward or see the whole video until the download is complete. Files for progressive downloads use a regular Web server with a url beginning with http://. Because video files are generally large, this can take a long time. The benefit of a progressive download for video is the quality can be higher; the benefit of progressive downloads for audio is the content can be saved to an individuals iPod or other mp3 player and listened to at their leisure. * Vanderbilt University prefers streaming for video, particularly longer videos, as it is much faster than progressive download and the concern about the alteration or misuse of Vanderbilt videos is greatly reduced as the content remains on the Vanderbilt media server.
  • P.51 Streamable Media File Every streamable media file must have the most important information – Hint Track. Hint Track instructs the streaming server to pick media data, encapsulate into packet and then put it onto network. A streaming server just follows instructions provided by Hint Track without knowing the content of the streamable media file. The informations Hint Track provides are put into SDP(Session Description Protocol) in RTSP payload. These informations include codec type, media file header, RTP payload type, the playbacking time, etc. MP4 file without Hint Track MP4 file with Hint Track 1. MP4 1.1. What is MP4? MP4 is a container format. As any other container format like AVI (.avi), RealMedia (.rm, .rmvb), QuickTime (.mov), MPEG (.mpg, .mpeg), Matroska (.mkv, .mka), OGM (.ogm) it allows you to combine different multimedia streams (mostly audio and video) into one single file.
  • P.52 MP4 is a file extension for the container format defined in the Systems Part of the MPEG-4 standard (ISO 14496-1). MP4 supports all kinds of multimedia content (multiple audio streams, video streams, subtitle streams, pictures) and advanced content (called "Rich Media" or "BIFS") like 2D and 3D graphics, user interactivity, DVD-like menus. MP4 is a streamable format. 1.2. MP4 file extensions MP4 files can have the following extensions: * .mp4 - official extension * .m4v - .mp4 files with the WRONG extension introduced by Apple for video+audio files, .m4v can be safely renamed to .mp4 (.m4v is used in Apple iTunes and iPod) * .m4a - .mp4 files with the WRONG extension introduced by Apple for audio-only files, .m4a can safely be renamed to .mp4 * .m4p - used by Apple iTunes for DRM protected files * .m4e - renamed .sdp files used by Envivio for streaming * .m4v, .mp4v, .cmp, .divx, .xvid, .264 - normally raw mpeg-4 video streams (not inside MP4) * .3gp, .3g2 - used by mobile phones, can also include content not defined for .mp4 (H.263, AMR) 2. How To Add Hint Track into MP4 & 3GP Files? 2.1 MP4 Files 2.1.1) Apple and MPEG4IP offer nice and free tools when it comes to streaming MP4: As a streaming server you can use Apple's Darwin Streaming Server. For live streaming you can use mp4live from MPEG4IP (only for Linux), on Windows you can use MPEGRecorder (which seems to be a port of mp4live). Also have a look at the tools from ViTooKi (opensource Streaming Server, Player and other tools). Another free and opensource MP4 streaming server is available from Catra. For MAC you may use Live Channel. 2.1.2) MP4Box is a MP4 multiplexer and a command line tool. It can import MPEG-4 video, DivX, XviD, 3ivx, h264 etc, audio streams and subtitles into the .mp4 container. The end result is a compliant MP4 stream. It can also extract streams from a .mp4. MP4Box is a command line tool, but can be used with graphical user interfaces such as YAMB. With AAC audio, it should use LATM(Low-overhead MPEG-4 Audio Transport Multiplex) RTP payload type : MP4Box.exe -hint -latm XXX.mp4 Others : MP4Box.exe -hint XXX.mp4 2.2 3GP Files
  • P.53 MP4Box commands for 3GP files with A/V codec : <I> AMR+H263 MP4Box.exe –hint -3gp XXX.3gp <II> AAC+MP4 MP4Box.exe -hint -latm XXX.3gp
  • P.54 RTP Payload Type for Streaming Media Codec Type RFC H.263 Video http://www.potaroo.net/ietf/rfc/PDF/rfc2429.pdf H.264 Video http://www.potaroo.net/ietf/rfc/PDF/rfc3984.pdf MPEG-4 Audio/Visual bitstreams Video http://www.potaroo.net/ietf/rfc/PDF/rfc3016.pdf AAC, LC and LTP Audio http://www.potaroo.net/ietf/rfc/PDF/rfc3016.pdf AMR-NB AMR-WB Audio http://www.potaroo.net/ietf/rfc/PDF/rfc3267.pdf
  • P.55 SHOUTcast – A Streaming Audio Tech SHOUTcast is server software for streaming media developed by Nullsoft. It allows digital audio content, primarily in MP3 or HE-AAC format, to be broadcast to and from media player software, enabling hobbyists and professionals to create Internet radio networks. It is cross-platform, and freeware. It consists of a client-server model, with each component communicating via a network protocol that intermingles audio data with metadata such as song titles and the station name. It uses HTTP as a transport protocol, although multicast is another option. Shoutcast servers are usually linked to by means of playlist files, which are small text files (usually with extensions .pls or .m3u) that contain the URL of the ShoutCast server. An attempt to visit that URL in a normal Web browser will usually result in a ShoutCast status page. For Android Android (我使用的是 1.5)透過一個叫做 android.media.MediaPlayer 的類別來提供撥放串流影音或本 地端影音檔的功能。不過,眾所皆知的,它支援的串流協定以及 codec,相當的有限。我想,這一點在 現在及未來,肯定會受到相當多開發者的注目以及戮力加強。 本文提到的是解決一個特定問題的方式,想解決的是在 Android 上撥放 SHOUTCAST MP3 stream。許 多網路音樂串流都是採用 SHOUTCAST MP3 stream 的方式,但即使 Android 支援了 HTTP 以及 MP3, 而且 SHOUTCAST MP3 stream 的內容幾乎就是 MP3 stream,但透過內建的 MediaPlayer,你仍然無法 撥放。這原因當然是因為 MediaPlayer 沒有處理 SHOUTCAST,即使 SHOUTCAST 的協定和 HTTP 是 那麼的相像。 由於我才接觸 Android 數日,可以說是對 Android 還相當的陌生,不知道除了走原生程式碼這條路外, 還有沒有別的方法(之前有想過,直接處理 SHOUTCAST 協定再自行 decode MP3,但似乎沒有內建的 MP3 decode 介面,或許有 Android 高手可以指點一下),所以設計了一個機制,在不寫任何原生程式碼 的情況下,讓 MediaPlayer 能處理 SHOUTCAST MP3 stream。 這個機制的核心想法是這樣樣子的 - 放置一個 HTTP proxy 介於 MediaPlayer 與 SHOUTCAST server 之間(當然 HTTP proxy 也跑在你的 Android 應用程式之中),這個 HTTP proxy 一手接收 MediaPlayer 的單純 HTTP 請求,另一邊則扮演一個 SHOUTCAST client,接收 SHOUTCAST server 回傳的內容,並 且依據 SHOUTCAST 協定,將回傳內容中的 MP3 stream 剖析出來,回傳給另一邊的 MediaPlayer。 今天實驗了一下,這個機制的確能夠讓 MediaPlayer 撥放 SHOUTCAST 的網路音訊串流。大抵的精神
  • P.56 如上所描述,不過細節處還不少。最重要的大概就是怎麼處理 MediaPlayer 的 HTTP 請求。MediaPlayer 基本上是兩個請求就搞定,一個是 HEAD 一個是 GET。透過 HEAD 它可以判斷究竟是否支援,再透過 接下來的 GET 取得真正的內容。當然,針對這兩個請求,Content-Type 都會是 audio/mpeg,而且千萬 不要忘了(或故意不)提供 Content-Length(因為是串流,所以,請給個超大的值吧),否則 MediaPlayer 在 prepare 的時候就會失敗了。 (Try chunk)
  • P.57 References 01. Video Lan Document : http://wiki.videolan.org/Documentation:Documentation VLC Knowledge : http://wiki.videolan.org/Knowledge_Base VLC Streaming HowTo :http://wiki.videolan.org/Documentation:Streaming_HowTo VLC Capability : http://www.videolan.org/vlc/features.html Streaming Capability : http://www.videolan.org/streaming-features.html How to stream on a VLC : http://www.ehow.com/how_5143120_stream-vlc.html Android VLC Remote : http://code.google.com/p/android-vlc-remote/ 02. LIVE555 Media Server http://www.live555.com/mediaServer/ 03. Darwin Streaming Server Main site : http://dss.macosforge.org/ Apple site introducing DSS : http://developer.apple.com/opensource/server/streaming/index.html DSS-6.03 Install : http://www.xtreamlab.net/howtos/broadcast/servers/darwin/howto_setup_darwin_streaming_server_on_lin ux.html DSS-6.03 Install in another way : http://cwshep.blogspot.com/2008/08/darwin-streaming-server-603-on-linux.html DSS Installation and Setup in regular Chinese : http://blog.xuite.net/hsunet0122/life/25320249 04. FFServer - FFMpeg Streaming Server Ffmpeg Wiki : http://wiki.multimedia.cx/index.php?title=Libavcodec 05. Flumotion Official Site : http://www.flumotion.net/ Source Code Download Site : http://www.flumotion.net/src/flumotion/ Introduction to Flumotion Commands : http://blog.gingertech.net/2006/08/02/running-flumotion-on-ubuntu/ Q&A : https://code.fluendo.com/flumotion/trac/wiki/FAQ#when-starting-flumotion-manager-i-get-error-pem-file-e tc-flumotion-default-pem-does-not-exist 06. To Add Ubuntu Universe and Multiverse Repository http://www.ubuntugeek.com/how-to-enable-the-universe-and-multiverse-repositories-in-ubuntu-804-hardy. html 07. Stream Server Passing through NAT/Firewall
  • P.58 http://soundscreen.com/streaming/firewall.html 08. Real-Time Streaming Protocol (RTSP) Specification : http://www.potaroo.net/ietf/rfc/PDF/rfc2326.pdf http://www.tml.tkk.fi/Studies/Tik-110.300/1998/Essays/rtsp.html http://www1.cs.columbia.edu/~hgs/rtsp/ http://www.javvin.com/protocolRTSP.html 09. Session Description Protocol (SDP) Specification : http://www.potaroo.net/ietf/rfc/PDF/rfc2327.pdf http://en.wikipedia.org/wiki/Session_Description_Protocol 10. Streamable Media Files http://forum.doom9.org/archive/index.php/t-91113.html http://all-streaming-media.com/streaming-media-faq/faq-mp4-streaming.htm http://en.wikipedia.org/wiki/MPEG-4_Part_14 http://en.wikipedia.org/wiki/ISO_base_media_file_format 11. MP4IP 12. MP4Box Official Site : http://gpac.sourceforge.net/doc_mp4box.php Ubuntu Manual : http://manpages.ubuntu.com/manpages/intrepid/man1/mp4box.1.html 13. SHOUTcast http://en.wikipedia.org/wiki/SHOUTcast