Filename
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:
|
Description |
index |
Contains the list of segment files and their timestamp ranges. |
context |
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:
Parameter |
Value |
---|---|
Simultaneous DVR streams |
25 |
Bit rate of each stream |
2 Mbit |
Codecs |
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(); nc.connect("rtmp://fms.example.com/live"); // 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(); s.play("livestream", -1, -1);
The following client-side ActionScript plays the RAW stream:
ns.play("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 www.adobe.com/go/ams_tools. The following example uses Flash Media Live Encoder and the DVRCast application.
Example: Publish and play a RAW stream
-
Download and install Flash Media Live Encoder from www.adobe.com/go/fmle.
-
Download the DVRCast application from www.adobe.com/go/ams_tools and do the following:
-
Unzip the package.
-
Copy the dvrcast1_1\DVRCast1.1\adobe\fms\samples\applications\dvrcast_origin folder and its contents to the Adobe Media Server rootinstall/applications folder.
-
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.
-
-
Connect a camera to your computer.
-
Open Flash Media Live Encoder and do the following:
-
Choose a preset. The RAW format supports all the codecs that Flash Player supports.
-
In the Output section, for the FMS URL, enter rtmp://localhost/dvrcast_origin.
-
For stream, enter raw:livestream.
-
Select DVR Auto Record
-
Click Start
-
-
Browse to rootinstall\applications\dvrcast_origin\streams\_definst_\livetream. The raw files are generated in this folder.
-
To view playback, do the following:
-
Open rootinstall/samples/videoPlayer/videoplayer.html in a browser.
-
For Stream URL, enter rtmp://localhost/dvrcast_origin/raw:livestream.
-
Select VOD.
-
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:
Code |
Error |
Level |
Message |
---|---|---|---|
-32 |
Missing/Corrupted Index or Context file |
Error |
Index or Contexts file missing or corrupted. |
-33 |
Raw file index version doesn't match FMS version |
Error |
Index File Version %x Not Supported. FMS Requires Version %x. |
-34 |
Segment file missing or corrupted |
Error |
Failed read in segment file %s. File missing or corrupted. |
-35 |
Truncated message in segment file |
Error |
Truncated message in segment file %s. |
-36 |
Bad message type |
Error |
Unrecognized message type in segment file %s. |
-37 |
Message backtag does not match length |
Error |
Invalid message footer in segment file %s. |
-38 |
Segment data does not match segment bounds |
Error |
Segment file %s does not match index file. |
-119 |
Contexts file contains no onMetadata message (and there is at least one segment file) |
Warning |
Missing FLV metadata. |
-126 |
Timestamp decreases from one message to the next |
Warning |
Found backward timestamp in segment file %s. |