Publishing live video in RAW fileformat

[adoberuntime]Flash Media Server 3.5.3[/adoberuntime]

About the RAW file format

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 Adobe Media Server supports, including H.264 video, data-only, audio-only, and so on.

The RAW file format is a server feature; any version of Flash Player can publish or play a RAW stream. However, multi-bitrate stream support (also called dynamic streaming) requires Flash Player 10 and higher.


The RAW file format is internal to Adobe Media Server. At this time, you cannot edit these files with third-party tools or convert the files to FLV format or MP4 format.

The RAW file format is an FLV file fragmented into the following files:




Contains the list of segment files and their timestamp ranges.


Contains all the “context messages” for the stream.

A 16-digit hexadecimal number

There is one file for each segment of the stream. The number of files is the stream index of the first message in the segment. The first segment name is always 0. If the first segment contains 234 messages, the next segment name is EA, and so on.

The files are stored in a folder whose name is the name of the stream. Suppose the stream “foo” is stored in a folder named “foo”. The “foo” folder contains the following files: index, context, 0000000000000000, 00000000000001C3, 0000000000000386, and so on.

The RAW file format enables Adobe Media Server to handle up to the following scenario:



Simultaneous DVR streams


Bit rate of each stream

2 Mbit


H.264 and AAC

Stream duration

4 hours (x 2 Mbit = 7 GB size)

Number of clients

Depends on origin-edge configuration.


Raw streams with long durations create many files in a single directory. Depending on system resources, the file system may not be able to access the directory fast enough for recording or playback to keep up.

Streaming RAW files


Both ActionScript 2.0 and ActionScript 3.0 support the RAW file format. Flash Media Live Encoder 3.0 does not support the RAW file format.

To record a live stream as a RAW stream, use the prefix raw: in the NetStream.publish() call or in the Stream.get() call.

The following client-side ActionScript uses the RAW file format to publish a live stream:

nc:NetConnection = new NetConnection(); 
// In production code, test for a successful NetConnection here 
ns:NetStream = new NetStream(nc); 
ns.publish("raw:livestream", "record"); 
// You can use the "record" or the "append" flag.

The following Server-Side ActionScript records a live stream as a RAW stream:

s = Stream.get("raw:recordedStream"); 
s.record();"livestream", -1, -1);

The following client-side ActionScript plays the RAW stream:"raw:livestream", 0, -1)

To use Flash Media Live Encoder, use the prefix raw: in the Stream field. Use a server-side script to record the stream. You can use the server-side script in the DVRCast application. Download the DVRCast application from The following example uses Flash Media Live Encoder and the DVRCast application.

Example: Publish and play a RAW stream

  1. Download and install Flash Media Live Encoder from

  2. Download the DVRCast application from and do the following:

    1. Unzip the package.

    2. Copy the dvrcast1_1\DVRCast1.1\adobe\fms\samples\applications\dvrcast_origin folder and its contents to the Adobe Media Server rootinstall/applications folder.

    3. To verify that the application is registered with the server, open the Adobe Media Server Administration Console. Click View Applications and select dvrcast_origin from the New Instance menu at the bottom of the screen.

  3. Connect a camera to your computer.

  4. Open Flash Media Live Encoder and do the following:

    1. Choose a preset. The RAW format supports all the codecs that Flash Player supports.

    2. In the Output section, for the FMS URL, enter rtmp://localhost/dvrcast_origin.

    3. For stream, enter raw:livestream.

    4. Select DVR Auto Record

    5. Click Start

  5. Browse to rootinstall\applications\dvrcast_origin\streams\_definst_\livetream. The raw files are generated in this folder.

  6. To view playback, do the following:

    1. Open rootinstall/samples/videoPlayer/videoplayer.html in a browser.

    2. For Stream URL, enter rtmp://localhost/dvrcast_origin/raw:livestream.

    3. Select VOD.

    4. Click Play Stream.

Validating RAW files and reading error messages

To check if a RAW stream is valid, pass a folder to the FLVCheck tool. For example, if you have a RAW stream named “foo” in the folder “C:\media\foo”, pass the following command to the FLVCheck tool:

flvcheck -f C:\media\foo -v -w

The following errors are reported by the FLVCheck tool version 2.0 and written to the log files:






Missing/Corrupted Index or Context file


Index or Contexts file missing or corrupted.


Raw file index version doesn't match FMS version


Index File Version %x Not Supported. FMS Requires Version %x.


Segment file missing or corrupted


Failed read in segment file %s. File missing or corrupted.


Truncated message in segment file


Truncated message in segment file %s.


Bad message type


Unrecognized message type in segment file %s.


Message backtag does not match length


Invalid message footer in segment file %s.


Segment data does not match segment bounds


Segment file %s does not match index file.


Contexts file contains no onMetadata message (and there is at least one segment file)


Missing FLV metadata.


Timestamp decreases from one message to the next


Found backward timestamp in segment file %s.

Adobe logo

Sign in to your account