A file with .asf extension is a multimedia file format for storing and playing digital media streams over the network. It is a container file format that can have both video and audio content for streaming online. You will rarely find ASF files, and more probably come across the Windows Media Audio (WMA) and Windows Media Video (WMV) files that both specify ASF files having content encoded with respective codecs. Windows media files can be created and read using the Windows Media Format SDK.
ASF File Format
An ASF file can comprise multiple independent or dependent streams. This can include multiple audio streams for multichannel audio or multiple bitrate video streams. The multiple bitrates make the streams suitable for transmission over different bandwidths. Moreover, the streams in an ASF file can be in compressed or uncompressed format. The best compression is achieved with the Microsoft Windows Media Audio and Video 9 Series codecs. Complete specifications of ASF file format are available on Microsoft Website.
ASF Top-Level File Structure
ASF files logically contain three types of top-level objects:
Header Object - mandatory and must be placed at the beginning of every ASF file
Data Object - mandatory and must follow the header object
Index Object(s) - optional, but useful in providing time-based random access into ASF files
The following image shows the top-level file structure of ASF files.
ASF Top-Level Header Object
The Header object provides a well-known byte sequence at the beginning of the ASF files and can optionally contain metadata such as bibliographic information. It contains all the information that is required to interpret the information within the data object properly. The Header Object may include several standard objects including, but not limited to:
File Properties Object - Contains global file attributes.
Stream Properties Object - Defines a digital media stream and its characteristics.
Header Extension Object - Allows additional functionality to be added to an ASF file while maintaining backward compatibility.
Script Command Object - Contains commands that can be executed on the playback timeline.
Marker Object - Provides named jump points within a file.
The Header Object is represented using the following structure:
Number of Header Objects
ASF Top-Level Data Object
All the digital media data for an ASF file is contained in the data object and is stored in the form of ASF data packets. Each data packet is of a fixed length and contains data for one or more digital media streams.
ASF Top-Level Index Objects
ASF top-level index objects have the following two types:
Simple Index Object - Contains a time-based index of the video data in an ASF file. The time interval between index entries is constant and is stored in the Simple Index Object.
Index Object - Refers to the Index Object, the Media Object Index Object, and the Timecode Index Object, whose formats are similar. Like the Simple Index Object, the Index Object indexes by time with a fixed time interval but is not limited to video streams.