Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Creating Streaming Movies

Streaming movies come in two forms: server movies and client movies.

You create a server movie that can be streamed over RTP by adding hint tracks. Hint tracks tell the server how to packetize the movie. You add hint tracks by exporting a movie as a hinted movie using QuickTime’s standard movie export mechanism.

You create a client movie that includes streaming content by adding one or more streaming tracks. A streaming track tells the client where to get the streaming media. In its simplest form, a client movie consists of just a streaming track containing the URL of a movie on a server. A client movie can contain multiple streaming tracks.

A client movie can contain non-streaming tracks with local media content as well as streaming tracks. Streaming tracks can be composited with local tracks. For example, a streaming track could be used as the source for an effect track that is local to the client movie.

In this section:

Server Movies
Client Movies


Server Movies

You create a streaming movie for an RTP server by adding hint tracks to an existing movie. You do this by calling ConvertMovieToFile, which invokes a movie exporter component. This displays a standard dialog box that lets the user specify “Export Movie to Hinted Movie,” set the parameters for hinting the movie, select compressors, and specify a file name and directory for the hinted movie (see Figure 2-5).

The hinting is performed by media packetizer components. QuickTime selects an appropriate media packetizer for each track and routes each packetizer’s output through an Apple-provided packet builder to create a hint track. One hint track is created for each streamable track in the movie.


Figure 2-5  Exporting a hinted movie

Figure 2-5 Exporting a hinted movie

Hint tracks are quite small compared with audio or video tracks. A movie that contains hint tracks can be played from a local disk or streamed over HTTP, like any other QuickTime movie. The hint tracks are only used when streaming the movie over RTP.

As long as your application supports movie exporter components, it should be able to create hinted movies. If you want to bypass the standard dialog for user input, selecting “Export Movie to Hinted Movie” programmatically, you will need to modify your code by adding the appropriate selectors.

A hinted movie does not need to be self-contained (flattened). It can reference sample media contained in other files. But observe these cautions:

Hint tracks are marked as inactive so they do not interfere with local playback. If you call FlattenMovie with the flattenActiveTracksOnly flag, the hint tracks are deleted from the flattened movie.

This release of QuickTime supports RTP streaming of video, audio, text (including HREF Tracks), and MIDI. If your movie contains other media types, or features that rely on track references, you cannot currently export the entire movie to a hinted movie. You can either stream such movies over HTTP, or you can put some of the tracks into a client movie and stream the rest, as described in the section “Compositing Streaming and Non-Streaming Tracks.”

Client Movies

You incorporate streaming content in a client movie by adding at least one streaming track. The simplest form of client movie has only one track: a streaming track with the URL of a movie on a server.

A streaming track has a media type of kQTSStreamMediaType ('strm') and contains a single media sample: typically either an RTSP URL of a streaming movie or the SDP text describing a multicast.

The code example in Listing 2-1 shows how to create a streaming track, insert a sample description, and add a URL media sample.

Listing 2-1  Creating a streaming track with an RTSP URL

Handle dataRef;
long dataLength;
char url[] = "rtsp://myserver.bigcompany.com/mystreaming.mov";
dataRef = NewHandle(strlen(url) + 1);
BlockMoveData(url, *urlDataRef, strlen(url) + 1);
dataLength = GetHandleSize(dataRef);
newMedia = NewTrackMedia(newTrack, kQTSStreamMediaType,
        kQTSMediaTimeScale, handleDataRef, HandleDataHandlerSubType);
err = BeginMediaEdits(newMedia);
qtsDesc =
(QTSSampleDescriptionHandle)NewHandleClear(sizeof(QTSSampleDescription));
(**qtsDesc).descSize = sizeof(QTSSampleDescription);
(**qtsDesc).dataFormat = 'rtsp';
(**qtsDesc).dataRefIndex = 1;
(**qtsDesc).version = kQTSSampleDescriptionVersion;
duration = kQTSInfiniteDuration;
err = AddMediaSample(newMedia, dataRef, 0, dataLength, duration,
        (SampleDescriptionHandle)qtsDesc, 1, 0, nil);
err = EndMediaEdits(newMedia);
err = InsertMediaIntoTrack(newTrack, 0, 0, GetMediaDuration(newMedia),
        kQTSNormalForwardRate);

A streaming track in a client movie can point to a server movie containing audio, video, text, and MIDI tracks. Any or all of the tracks in the server movie can appear as a single streaming track in the client movie.

To sum up:



< Previous PageNext Page > Hide TOC


Last updated: 2006-01-10




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice