Real Time Streaming Protocol

  • 509 views
Uploaded on

 

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
509
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
9
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. DRAFT, July 15, 2010 In This Tutorial: • Real Time Clipper QuickTime Streaming Protocol Movies • Compressing Audio and Video Tracks • Alternate Data Rate Movies • Media Cleaner Pro With apologies to Apple for absconding with boatloads of their tutorial text, here’s a layman’s intro to making QuickTime movies for Clipper and friends. Now, I’m a novice at this stuff, but maybe, just maybe, I can highlight important aspects of making QuickTime movies suitable for dialup access. Please feel free to critique this, and let me know of any changes, additions, subtractions and stupid errors. Real Time Streaming Protocol RTSP1 may be defined as the transfer of multimedia over a network while it is playing, as opposed to downloading the data and storing it locally before playing it. With HTTP streaming, the movie data (known as a Fast Start, or Progressive Download movie) is sent to your browser as fast as the network connection can handle it. Once enough data has been received, the movie will begin to play. With RTSP streaming, movie data is only sent as needed, so the data rate of your stream has to be smaller than the network's current speed. A movie’s data rate is usually expressed in units of bits/second (b/s), kilo- 1 RTSP uses the Real-time Transfer Protocol, RTP, as its transport medium. RTP does not download an entire movie to the client computer. Instead, it siphons out a thin, one-way data stream at a constant data rate that plays the broadcast in real time (after a few initial moments of handshaking and data-buffering). A streamed one-minute movie plays in exactly one minute. As long as the connection has enough bandwidth to handle the data stream, the movie will play. After the data is displayed, it’s discarded. Viewers can see the broadcast again only by requesting it from the streaming server. RTSP makes the experience interactive, because the user can move the slider to view any portion of the movie, in real time, without having to load earlier data. Try it – view a streaming movie and then move the slider to the end – the movie starts playing at its new position immediately (we have a random access movie!). 1
  • 2. DRAFT, July 15, 2010 bits/second (Kb/s), or kilo-bytes/second (KB/s). Later on we’ll see how to take a movie and compress it – lower it’s data rate – so the movie can stream at one or more connection speeds. Connection speeds can vary from a 28,000 to 56,000 b/s dialup line, to a LAN connection here at work running at 10 to 100 million b/s. Before you can stream an existing QuickTime movie using QuickTime Streaming, you must "hint" it. Hinting involves analyzing the media data within a movie and creating hint tracks that tell the streaming server software how to package the data to send over the network. The hinting process will create a hint track for each media track you wish to stream. The hint tracks are stored within the same movie -- the hinted movie -- as are the original media tracks. Using QuickTime Player's Export feature, we’ll see how to compress and hint your movies, which are then stored on Clipper for streaming. Exporting a QuickTime Movie – An Overview QuickTime Player is an example of an application that can compress movies and create hint tracks2. Another good choice is Media Cleaner, which we’ll examine later. Begin by opening a movie in QuickTime Player by either dragging the movie onto the application icon or launching QuickTime Player and choosing Open Movie from the File menu. In order to hint the media, select Export from the File menu, which displays the following dialog: 2 I use QuickTime 4 Pro. QuickTime 4 is available as a free download, for both Mac OS and Win32, from http://www.apple.com/quicktime/download. In order to hint (or compress) an existing QuickTime movie you’ll need to spend $30 to upgrade from the basic player to the Pro version. 2
  • 3. DRAFT, July 15, 2010 A. Where it says Save exported file as enter a file name with the “.mov” extension. When naming your movies, keep things simple for DOS-land, our lowest common denominator, and limit their names to eight characters, without spaces or special characters. B. In the Export pop-up, content creators can either select Movie to Hinted Movie or Movie to QuickTime Movie, to prepare their media for streaming. You should select Movie to Hinted Movie when the audio and video content has already been compressed to the desired data rates. Otherwise, select Movie to QuickTime Movie to compress the movie, prior to hinting. When selecting Movie to QuickTime Movie a predetermined set of presets have been defined which are accessible in the Use pop-up menu. C. Use allows content creators to select from the Default Settings or the Most Recent Settings. Unless you are compressing a movie, the Default Settings are recommended, as QuickTime determines, for example, the appropriate payload and packet size limits for each track type QuickTime can stream. Most Recent Settings uses the last Export settings, and is convenient when you’re compressing multiple movies. D. The Options button has different settings depending upon whether you selected Movie to Hinted Movie or Movie to QuickTime Movie. With Movie to Hinted Movie, only authors with advanced expertise should change the defaults, as this may cause poor performance and quality of the stream. It’s an entirely different matter when using Movie to QuickTime Movie, because that’s how we compress the audio and 3
  • 4. DRAFT, July 15, 2010 video tracks, detailed in the next section, Compressing Audio and Video Tracks. Finally, use Save to create your hinted or compressed movie. Compressing Audio and Video Tracks The Clipper movies look like they’re going to be rather simple, with just one audio and one video track. Both tracks must be compressed so that the sum of their data rates doesn’t exceed the desired connection speed. Here’s where it gets tricky, because we can’t tell in advance what type of connection a client may have. So, what data rate do we design for? One solution is Alternate Data Rate Movies, where we have a single reference movie, plus alternate movies of varying data rates. It’s up to the QuickTime client to determine which of the alternate movies will play best, based on client settings such as connection speed. This is cool, because web designers now code but a single URL, rather than a series of URLs for the ADR movies. For argument’s sake, I know Clipper’s target is a 56 Kb/s dialup line. Realistically, then, let’s assume an average actual connect rate of 37,000 b/s, and apply the “allow 25% for overhead” rule. That means our target data rate is 27,750 b/s – more or less a 28.8 KB/s modem! Here’s how we do it: First, ensure that Movie to QuickTime Movie is selected in the Export dialog box. Click Options to see the Movie Settings Dialog. Choose the video size and compressor settings in the Video section and the audio compressor settings in the Sound section. Check the Prepare for Internet Streaming box and choose Hinted Streaming from the popup menu. 4
  • 5. DRAFT, July 15, 2010 Click on Settings, which posts the following dialog, select Optimize Hints For Server, and then OK to return to the Movies Settings window. The next tricky part is selecting exactly which compressor (or codec), for both audio and video, is best suited for the task – and there are scores of choices. What I found worked well was Sorenson Video and Qualcomm PureVoice Audio. Make your selection by clicking on the Settings button. For video, you’ll see this dialog box: 5
  • 6. DRAFT, July 15, 2010 In this example, I’ve selected 12 frames/second and limited the data rate to 2 KB/s. With a video data rate of 20,000 b/s, that leaves around 8,000 b/s for audio. You’ll have to experiment with these settings until you are satisfied with the results – I am not a media author. One thing I do know, though, is as you increased the quality of the video, you’ll have to simultaneously decrease the frame rate. Generally, try for a frame rate of at least 10 f/s. Finally, you can limit the data rate manually, which is what I did. Similarly, here’s what the audio compression dialog looks like: 6
  • 7. DRAFT, July 15, 2010 Now, once you’ve compressed the movie, select Movie to Hinted Movie in preparation for saving it as a self-contained, hinted, compressed movie. OK out of the stacked dialogs, ensure the movie is named in a friendly DOS 8.3 format, and click Save. QED. Alternate Data Rate Movies MakeRefMovie Executive summary as of 2000/11/14: • In one folder, create as many alternate movies as required, perhaps a default 14.4, a 56 and, possibly, a LAN version. Hint these movies. • Further, take all these hinted alternates and save them yet again as self-contained Fast Start movies – feel free to re-use the same file names. • Make the reference movie using MakeRefMovie. Use Movie/Add Movie to add the default movie, and select Flatten Into Output. Use Movie/Add URL to add the RTSP streaming movies – the URL must point to the movie’s location on the server, e.g. rtsp://clipper.lehigh.edu/steve/clip1_56_S.mov. • A web page uses an <EMBED> tag specifying the reference movie, served via http, e.g. <p>Let's watch a <EMBED SRC=http://clipper.lehigh.edu/movies/UNeedQT4.qti QTSRC=http://clipper.lehigh.edu/movies/steve/clip1_MSTR.mov WIDTH=480 HEIGHT=280 TYPE="application/x-rtsp"> movie! • The SRC attribute should always be what you see - it's a small movie that the plugin unconditionally loads, but is otherwise unneeded. The QTSRC attribute is 7
  • 8. DRAFT, July 15, 2010 the HTTP URL of the reference movie, designated by *_MSTR.mov (master, I assume). The WIDTH and HEIGHT attributes are those of the largest movie. Add 16 to the HEIGHT to account for the QuickTime controller widget. (See Steve Lidie for details on other EMBED attributes, like BGCOLOR, so the movie blends with your page.) ADR Details Creating ADR movies is a straightforward process. Start by creating a master movie of the highest possible quality. That means the largest frame size, the highest frame rate, and the least compression on audio and video tracks. You’ll be making the alternate movies from this master. Determine the number of alternate data rate movies you want to create, and the rate for each one. A typical spread for web delivery is one each for 56Kb/s maximum (but usually much lower), DSL/cable (up to about 128 Kb/s), and T1/T3 (up to 1 Mb/s). Here are some guidelines: Connect Speed Date Rate Playback Size (pixels) 28.8/33.6 modem 20 Kb/s 80 x 60 56K/ISDN 40 Kb/s 120 x 90 112K Dual ISDN 90 Kb/s 160 x 120 T1 1 Mb/s 320 x 240 LAN 100+ Kb/s 320 x 240 Create the alternate data rate movies from the master using the appropriate image dimensions and codecs. You can do this in QuickTime Player using the Export option in the File menu (discussed previously), or use Media Cleaner Pro 1, which generates all the alternate movies in a batch according to the data rates you specify. If some of your alternates are streaming movies, make Fast Start movies that point to them, and use the Fast Start movie as the alternate for the stream. To create a Fast Start movie that points to a streaming movie, open the streaming movie in QuickTime Player by choosing Open URL from the File menu and typing in the URL. Then choose Save As from the File menu, name it, and save it as a self-contained movie. 1 Media Cleaner Pro runs on Mac OS or Win32, and costs $600. If you folks have the dollars, this solution will be more efficient than using the QuickTime player application. Then again, if you’re only making a handful of movies, QuickTime Pro should suffice. See http://www.terran.com. 8
  • 9. DRAFT, July 15, 2010 Also create a default movie that anyone in your audience can see, no matter what connection or computer they are using. It could be a few frames from your movie with a low-bandwidth audio track, or a single image with a scrolling text track and no audio, or just a single image. In any case, keep it very small, because the browser will download it even if an alternate movie is used. If you make a movie, use an old codec like Cinepak for backward compatibility. If you use an image, it must be in QuickTime Image Format (QTIF), other image formats are not supported, Name each movie in a logical way, including the .mov filename suffix. For example, you may want to name your alternate movies altmov01.mov, altmov02.mov, and altmov03.mov. Save as self-contained movies. Store them all in the same folder or directory. Making a Reference Movie To complete the ADR setup you need to make a reference movie. You can make a reference movie for Alternate Data Rate movies based on connection speed (or other criteria, for that matter) using an application such as Terran’s Media Cleaner, or the free utility program MakeRefMovie, available from Apple for Mac OS and Win32. The latest version of MakeRefMovie can also create reference movies that choose among alternate movies based on CPU speed, language, or QuickTime version. Once you’ve made the alternate movies, follow these steps in MakeRefMovie. Open MakeRefMovie. Save your new document in the same folder or directory where the alternate movies are located. Make sure the reference movie filename contains the .mov extension. This reference movie will call upon the alternates. Drag each of the alternate movies onto the window of MakeRefMovie. An alternate movie will appear for each file you drag-and-drop. Or you can open each file separately by choosing Add Movie File from the Movie menu. NOTE: for streaming movies only drag (or use Add Movie) for the default movie – use Add URL to add the streaming movies. Set the minimum connection speed for each alternate movie in the Speed: pop-up menu. Set the load order of the movies in the Priority pop-up. For example, you may want the reference movie to call the highest quality movie first, then the medium quality movie, and last the lowest-quality or default movie. If there is more than one movie designed for the same connection speed, set a priority for which movie will load first. 9
  • 10. DRAFT, July 15, 2010 Specify the default movie by checking Flatten into output. The default movie should be compressed with a codec supported by older versions of QuickTime for backward compatibility. This checkbox can only be applied to one movie. Save the reference movie and place it and all the alternate movies in the same directory. Upload the directory or folder to the Clipper server. If you are putting the movies on a web page, embed the reference movie into the HTML using the <EMBED> tag. The reference movie will load the appropriate alternate based on the viewer’s connection speed. Embedding QuickTime for Web Delivery The <EMBED> tag allows media file types other than those directly supported by the browser to be handled with an external application or plugin. In this case, the external application is QuickTime Player and the plugin is the QuickTime Plugin. The list of <EMBED> attributes is long; here we document the <EMBED> attributes specific to QuickTime. The <EMBED> tag is similar to the <IMG> tag; they both have a SRC, WIDTH and HEIGHT parameter. These parameters are required and tell the browser the media to be displayed and the width and height of the media specified in the SRC attribute. For 10
  • 11. DRAFT, July 15, 2010 example: <embed src="sample.mov" width="320" height="256"> The SRC attribute is the media file to display either by an absolute or relative URL. The HEIGHT attribute specifies the vertical size in pixels of the SRC attribute. The WIDTH attribute specifies its horizontal size. In order for the controller to appear properly, add 16 pixels to the height of a movie. For example, set HEIGHT="256" for a movie 240 pixels high: <embed src="sample.mov" width="320" height="256"> For a sound-only movie, use a height of 16 for the controller and any width that looks good on your web page. (If you set the width to 16 for a sound-only movie, the controller is minimized to a single Play/Pause button). For example: <embed src="sound.mov" width="216" height="16"> Never set HEIGHT or WIDTH to less than 2, even if the movie is hidden. Please refer to the Executive Summary at the start of this section for further <EMBED> details. Media Cleaner Pro Normally, Steve Lichak (of Media Productions) will run this application for you to create a batch of RTSP movies. Besides the actual movie, Steve needs the fully qualified RTSP address of the directory where the alternate and reference movies will reside on the streaming server, e.g.: rtsp://clipper.lehigh.edu/steve This is where the reference movie looks for the alternate data rate streams. Remember, this is an RTSP address. HTTP addresses need a fully qualified path, hence include the directory name movies. An RTSP address starts at the "movie root" - movies - hence it's not part of the URL. This is just standard web stuff. After the media Cleaner Pro run finishes, Steve hands you a ZIP disk containing two folders, Upload to HTTP Server and Upload to Streaming Server. The first folder contains the reference movie and the second folder the multiple ADR movies. Upload the contents of these two folders to the movies directory on Clipper.Lehigh.EDU. Of course, don't use movies itself, but rather the subdirectory corresponding to the RTSP address you supplied Steve. The reference movie and all alternates must reside in this directory. When writing your HTML, use an <EMBED> tag similar to that described in the Executive Summary in the previous section, Alternate Data Rate Movies. 11
  • 12. DRAFT, July 15, 2010 If you want to experiment with Media Cleaner Pro yourself, here’s a brief rundown on its usage. Now, I have very little experience with Media Cleaner Pro, but basically you just use a “wizard” that leads you by the nose through a series of screens. With your accumulated knowledge gained from reading this tutorial, you can actually make educated guesses! After starting the application, either drag a movie onto Media Cleaner, or open the movie in the File menu. You’ll see a window similar to this. Click on the movie’s Setting column button to start a “wizard” to assist you (note that it’s already started, in the lower right corner). The screens you will see can vary, but a typical scenario follows. For our purposes, click on the WWW button and proceed to the next screen. 12
  • 13. DRAFT, July 15, 2010 Select the QuickTime button. Select QuickTime Streaming. 13
  • 14. DRAFT, July 15, 2010 Select target data rate – make multiple selections for an ADR batch. Make your best guess here! 14
  • 15. DRAFT, July 15, 2010 Select Sorsenson. Select movie dimensions. 15
  • 16. DRAFT, July 15, 2010 Select frame rate. Hey, experiment! 16
  • 17. DRAFT, July 15, 2010 Ah hah, a summary page, showing the movie’s total data rate. Click Finish, upload to Clipper, and test. Good luck, feel free to contact me. Steve Lidie, sol0@Lehigh.EDU 2000/11/17 17