Streaming media

Stream media

Media (which can contain audio, video, and data) is sent between a client and Flash Media Server in real time and displayed as it arrives. This type of data transmission is called streaming. The media streamed between a client and Flash Media Server is called a stream. Streams use a publish-and-subscribe model; subscribe means play. Either a client or a server can publish a stream; only a client can play a stream. Media can stream over RTMP or HTTP.

For example, a producer could use Adobe Flash Media Live Encoder to capture and encode live audio and video from a keynote speech and publish it to the server. Users could view the speech in a Flash Player or AIR client that subscribes to the stream.

In another scenario, a user on a social media website could publish a live stream in a video chat application; in this case, Flash Player would capture the video from the user’s webcam. Other users on the social media site could view the stream live, or, if the developer added this functionality, play the recorded stream at a later time.

Note: All editions of the server except Flash Media Streaming Server can record live streams for playback at a later time.

A server can publish a stream to clients or to other servers. For example, you might want to pull XML data into a server-side script to create a playlist and publish it as a stream to clients. A server would publish a stream to another server to scale live broadcasting applications to support more clients.

Multicast media

Multicasting is distributing audio and video data among members of an RTMFP group. The server doesn’t send data to each client—the data is distributed among peers. Multicasting allows few publishers to send a large amount of data. To multicast media, use the GroupSpecifier class to construct an opaque groupspec string that describes an RTMFP group. Pass the groupspec to the NetStream constructor. Call NetStream.publish() or NetStream.play() to multicast the data. You can use the client-side NetStream class and the server-side NetStream class to multicast data. See Multicasting.

Supported protocols

RTMP (Real-Time Messaging Protocol)

All server editions communicate with Flash Player and AIR over Real-Time Messaging Protocol. RTMP is optimized to deliver high-impact streams in real time. An RTMP connection can multiplex any number of streams. Each stream contains synchronized audio, video, and data channels. Remote method invocation and shared object messages are carried in a data-only stream.

Flash Media Server supports the following types of RTMP connections:

RTMP
This is the standard, unencrypted Real-Time Messaging Protocol. The default port is 1935; if a port is not specified, the client attempts to connect to ports in the following order: 1935, 443, 80 (RTMP), 80 (RTMPT).

RTMPT
This protocol is RTMP tunneled over HTTP; the RTMP data is encapsulated as valid HTTP. The default port is 80.

RTMPS
This protocol is RTMP over SSL. SSL is a protocol for enabling secure communications over TCP/IP. (Flash Media Server provides native support for both incoming and outgoing SSL connections.) The default port is 443.

RTMPE
This protocol is an encrypted version of RTMP. RTMPE is faster than SSL, does not require certificate management, and is enabled in the server’s Adaptor.xml file. If you specify RTMPE without explicitly specifying a port, the Flash Player scans ports just like it does with RTMP, in the following order: 1935 (RTMPE), 443 (RTMPE), 80 (RTMPE), and 80 (RTMPTE).

RTMPTE
This protocol is RTMPE with an encrypted tunneling connection. The default port is 80.

RTMFP (Real-Time Media Flow Protocol)

This protocol is a UDP-based, secure network transport between Flash Player or AIR and Flash Media Server. UDP provides lossy transmission, lower latency, and better prioritization than RTMP. RTMFP can be used for client-to-server and peer-to-peer communication. RTMFP allows clients to publish and play audio and video to each other without relaying media through the server. Clients must connect to Flash Media Server before they can pass data to each other. You can use RTMFP to build peer-assisted networking applications. You can also use RTMFP for traditional broadcast applications.

For more information about the protocol, see Adobe Computer Scientist Jozsef Vass’ article Benefits of RTMFP.

For more information about using RTMFP, see Building peer-assisted networking applications.

For more information about configuring the server to use RTMFP, see Configure IP addresses and ports for peer-assisted networking.

HTTP (Hypertext Transfer Protocol)

Progressive download

If you install Apache HTTP Server with Flash Media Server, you can deliver the client SWF file, container HTML page, and additional assets over HTTP.

You can write client-side ActionScript that causes Apache to serve media assets over HTTP progressive download if RTMP streaming fails. For example, if a client attempts to stream a video over RTMP and fails, the server attempts to tunnel RTMP over HTTP. If that attempt fails, the server delivers the video over HTTP.

See Configuring Apache HTTP Server.

Adobe HTTP Dynamic Streaming and Apple HTTP Live Streaming

Delivering content over HTTP is called “progressive download”. The content must transfer from the server to the client in a progression from the beginning to the end of a file. A client cannot seek to a forward location until that location and all the data before it has downloaded.

Delivering content over RTMP is called “streaming”. The media server (such as Flash Media Server) creates a socket connection to the client over which the content is sent in a continuous stream. The client can seek to any point in the content instantly, regardless of how much data has been transferred.

HTTP Dynamic Streaming combines these approaches. HTTP Dynamic Streaming packages media files into fragments that Flash Player clients can access instantly without downloading the entire file. Adobe HTTP Dynamic Streaming contains several components that work together to package media and stream it over HTTP to Flash Player. These components install with Flash Media Server.

Flash Media Server 4.0 supports live real-time packaging for HTTP Dynamic Streaming.

Flash Media Server 4.5 adds support for live and on-demand real-time packaging for Apple HTTP Live Streaming. Serve on-demand and live media to Flash Player, AIR, and iOS devices over HTTP.

Flash Media Server 4.5 also adds support for on-demand real-time packaging for Adobe HTTP Dynamic Streaming.

See Configure Apache for Adobe HTTP Dynamic Streaming and Apple HTTP Live Streaming, Stream live media (HTTP), and Stream on-demand media (HTTP).

Supported file formats and codecs

It’s important to understand the difference between a file format and a codec. A file format is a container that holds one or more pieces of media. F4V is a file format. A codec describes the format of the media. H.264 is a codec. A container can hold multiple pieces of media. For example, an F4V file can contain audio that uses the AAC codec and video that uses the H.264 codec.

File formats

All editions of Flash Media Server stream the following file formats:

FLV
All versions of Flash Media Server support playback and recording of the FLV file format. On-demand, real-time HTTP Dynamic Streaming does not support the FLV format.

F4V (MPEG-4 compatible)
Flash Media Server versions 3 and later support playback of all Flash Media Server-supported audio and video codecs within MPEG-4 Part 12 container formats. File types supported by the MPEG-4 format include F4V, MP4, M4A, MOV, MP4V, 3GP, and 3G2.

Flash Media Server 3.5 introduces support for recording in MPEG-4 format. Live video and audio streams containing any codecs supported by Flash Media Server can be recorded on the server into the F4V format.

Important: If a file contains portions of audio and video whose codecs are unsupported by Flash Media Server, those parts of the stream do not play.

MP3
The MPEG Layer-3 (mp3) file format is an audio file format that uses lossy data compression.

RAW
The RAW (Record and Watch) file format records media into configurable chunks that stream to any version of Flash Player. Use the RAW file format to serve long-length, multi-bitrate DVR streams without running into performance issues. The RAW file format records and plays back all streams that Flash Media Server supports, including H.264 video, data-only, audio-only, and so on.

F4M
The Flash Media Manifest file format contains information about a Flash media asset. Manifest information includes the location of media, codecs, resolutions, and the availability of files encoded at multiple bit rates, DRM authentication information, and so on. Use the F4M file format for HTTP Dynamic Streaming.

F4F
The F4F file format describes how to divide media content into segments and fragments. Each fragment has its own bootstrap information that provides cache management and fast seeking. Use the F4F file format for HTTP Dynamic Streaming.

Use the following table to see which file formats, server versions, and Flash Player versions the codecs support:

File format

Codec

Flash Media Server version

Flash Player version

FLV

Sorenson Spark

1

6; AIR 1; Flash Lite 3

FLV

Nellymoser

1

6; AIR 1; Flash Lite 3

FLV

On2 VP6

1

8; AIR 1; Flash Lite 3

FLV

Speex

3

10; AIR 1.5

MPEG-4: F4V, MP4, M4V, 3GPP

H.264*

Play back—3; Recording—3.5

9,0,115,0; AIR 1

MPEG-4: F4V, MP4, M4V, 3GPP

AAC+ / HE-AAC / AAC v1 / AAC v2

Play back—3; Recording—3.5

9,0,115,0; AIR 1

MPEG-4: F4V, MP4, M4V, 3GPP

MP3

Play back—3; Recording—3.5

9,0,115,0; AIR 1

MPEG-4: F4V, MP4, M4V, 3GPP

On2 VP6

Play back—3; Recording—3.5

9,0,115,0; AIR 1

mp3

mp3

1

6; AIR 1; Flash Lite 3

RAW

All codecs supported by Flash Player.

3.5.3

6; AIR 1; Flash Lite 3

F4M

N/A

4.0

10.1, AIR 2

F4F

All codecs supported by Flash Player except mp3 and Speex.

4.0

10.1, AIR 2

Note: H.264 playback in Flash Player supports most profiles including Base, Main, and HiP. The F4V format is a subset of MPEG-4 ISO 14496-10 and AAC+ (ISO 14496-3).

Codecs

Flash Media Server doesn’t encode or decode audio and video information. Flash Media Server streams media that has already been encoded.

To encode on-demand media, use any codec that supports the version of Flash Player or AIR that you want to target.

To capture, encode, and stream live video, you can either use Flash Media Live Encoder or use ActionScript to build your own Flash Player or AIR client. Flash Media Live Encoder 2.5 and later encodes video in the On2 VP6 codec or the H.264 codec. Flash Player and AIR encode live video with the Sorenson Spark codec and encode live audio with a proprietary Nellymoser codec.

The following table lists the supported codecs and their earliest required SWF file format and Flash Player versions:

Codec

Audio or Video

SWF file format version (earliest supported publish version)

Flash Player version (earliest version required for playback)

Sorenson Spark

Video

6

6, Flash Lite 3, AIR 1

Nellymoser

Audio

6

6, Flash Lite 3, AIR 1

mp3

Audio

6

6, Flash Lite 3, AIR 1

On2 VP6

Video

8

8, Flash Lite 3, AIR 1

H.264 (MPEG-4 Part 10)

Video

9

9 Update 3, AIR 1

AAC (MPEG-4 Part 3)

Audio

9

9 Update 3, AIR 1

Speex

Audio

10

10, AIR 1.5

Note: Flash Player and AIR support an alpha channel in the On2 VP6 codec only.

Flash Player 9 Update 3 (9, 0, 115, 0) supports playback of the following subsets of the MPEG-4 file format standards:

MPEG-4 standard

Flash Player 9 Update 3/AIR support

ISO/IEC 14496-3 (Audio AAC)

AAC Main; AAC LC; SBR. These codecs are also known as HE-AAC.

ISO/IEC 14496-10 (Video AVC)

Base (BP); Main (MP); High (HiP). All levels are supported.

ISO/IEC 14496-12 (Container)

1 Audio track; 1 Video track

3GPP TS 26.245 (Timed text format)

Full support

Supported metadata formats

You now deliver Adobe Extensible Metatdata Platform (XMP) metadata embedded video streaming through Flash Media Server to Flash Player. XMP is a labeling technology that allows you to embed data about a file into the file itself. XMP metadata is a system that communicates critical media information from the point where the media is created to the point where media is viewed. With XMP, applications and publishing systems can capture, share, and leverage metadata. In Flash Media Server, all the metadata embedded within a media file is accurately delivered. In addition, speech-to-text metadata embedded within files and encoded from Adobe Media Encoder CS4 can be delivered. For detailed information about XMP, see www.adobe.com/go/learn_fms_xmp_en.