A Windows Media metafile is a text file of tags. It looks like XML but is read more loosely. Microsoft’s Windows Media Player SDK defines it, in the metafile elements reference and Creating Metafile Playlists. This page covers the rules for the file as a whole. The elements themselves are on the structure, information and timing pages.
Identifying a metafile
The first four characters of the file must be <ASX. The
ASX element appears exactly once, it has no parent, and it is used in
every metafile whatever the file’s extension. The element identifies the file as a
metafile; it does not say what kind of media the file refers to.
The VERSION attribute is required and must come straight after the
element name. The current syntax is version 3, written 3 or
3.0. Microsoft says the Player “supports all previous versions of
metafile syntax”, but it does not document those earlier versions.
Tag rules
| Rule | Detail |
|---|---|
| Case | Element and attribute names are not case-sensitive, and may be upper case, lower case or a mixture. <Entry>, <ENTRY> and <entry> are the same element. A strict XML parser will reject a file that mixes the case of a start and end tag, which is one reason to read ASX with a forgiving parser. |
| Empty elements | An element with no children may end its opening tag with /> in place of a closing tag. |
| Children | Child elements must lie between the opening and closing tags of their parent; anywhere else they are ignored or are a syntax error. |
| Comments | <!-- text -->, anywhere except inside a tag between its < and >. They are ignored when the file is parsed. |
| Text | Save as plain text with no word-processor formatting. Microsoft’s guidance is plain text or ASCII. To say that the file is UTF-8, include <PARAM NAME="Encoding" VALUE="utf-8"/> (see PARAM). |
| Minimum content | An ASX element must contain at least one ENTRY or ENTRYREF. |
| Repeated single elements | Where a parent should hold one TITLE, AUTHOR, COPYRIGHT or ABSTRACT, only the first is used; later ones are ignored. |
Extensions and media types
The extension is a hint about the content; the file’s syntax is the same in each case. Microsoft’s advice is to name the metafile after the media it points to.
| Extension | Used for | Media type in common use |
|---|---|---|
.asx | Metafiles that reference files with .wma, .wax, .wmv, .wvx, .asf or .asx extensions | video/x-ms-asf |
.wax | Metafiles that reference files with .asf, .wma or .wax extensions | audio/x-ms-wax |
.wvx | Metafiles that reference files with .wma, .wmv, .wvx or .wax extensions | video/x-ms-wvx |
.wmx | Reserved | video/x-ms-wvx |
This is Microsoft’s “File Name Extensions” page, which recommends that a file’s media
type, not its extension, identify it. There is no video/x-ms-wmx: the page gives
.wmx the media type video/x-ms-wvx and marks it Reserved. The
type video/x-ms-asf is also the type of .asf media files on that
page, so a server’s type alone does not tell a metafile from an ASF file. Check for the
<ASX opening instead (Creating Metafile Playlists). A second Microsoft
page, “Metafile Extension Guidelines”, gives a shorter table: .wvx may reference
.asf, .wma and .wmv; .wax .asf and .wma;
.asx only .asf. The two tables differ. Microsoft adds that every metafile starts with
the ASX element, whatever its extension.
The element tree
Every element of version 3. The parent and child columns are Microsoft’s; an element found elsewhere is not defined by the format.
| Element | Parents | Children | Purpose |
|---|---|---|---|
ASX | none (root) | ABSTRACT AUTHOR BANNER BASE COPYRIGHT ENTRY ENTRYREF EVENT MOREINFO PREVIEWDURATION PARAM REPEAT TITLE | The whole metafile |
ENTRY | ASX EVENT REPEAT | ABSTRACT AUTHOR BANNER BASE COPYRIGHT DURATION ENDMARKER MOREINFO PARAM PREVIEWDURATION REF STARTMARKER STARTTIME TITLE | One clip |
REF | ENTRY | DURATION ENDMARKER PREVIEWDURATION STARTMARKER STARTTIME | Address of the media |
ENTRYREF | ASX EVENT REPEAT | none | Pulls in the entries of another metafile |
REPEAT | ASX | ENTRY ENTRYREF | Loops the enclosed clips |
EVENT | ASX | ENTRY ENTRYREF | Clips to play when a script command arrives |
TITLE | ASX ENTRY | none | Title |
AUTHOR | ASX ENTRY | none | Author |
COPYRIGHT | ASX ENTRY | none | Copyright text |
ABSTRACT | ASX ENTRY BANNER | none | Description, shown as a tooltip |
MOREINFO | ASX ENTRY BANNER | none | Web, email or script address |
BANNER | ASX ENTRY | ABSTRACT MOREINFO | Banner graphic |
BASE | ASX ENTRY | none | Prefix for URL-flip addresses |
LOGURL | ASX ENTRY | none | Where to send log data |
PARAM | ASX ENTRY | none | Named value |
SKIN | ASX | none | Border file (deprecated) |
DURATION | ENTRY REF | none | How long to play |
PREVIEWDURATION | ASX ENTRY REF | none | How long to play in preview mode |
STARTTIME | ENTRY REF | none | Time to start from |
STARTMARKER | ENTRY REF | none | Marker to start from |
ENDMARKER | ENTRY REF | none | Marker to stop at |
Microsoft’s page for LOGURL says it may be a child of ASX
or ENTRY, but its pages for ASX and ENTRY do
not list it among their children. The same is true of SKIN and
ASX. Both are listed here by the page that defines them, and in practice
both appear where shown.
Time values
The VALUE attribute of DURATION,
PREVIEWDURATION and STARTTIME is written
hh:mm:ss.fract, in hours, minutes, seconds and hundredths of a second.
Leading fields may be left out.
| Value | Meaning |
|---|---|
00:00:30 | 30 seconds |
1:01.5 | 61.5 seconds (1 minute, 1.5 seconds) |
1:30.0 | 90 seconds |
0:30.0 | 30 seconds |
URLs
An HREF holds a URL in any protocol the Player supports, usually
http, https or the older mms (Microsoft Media
Services). A local path such as c:\asfroot\Port na Pucai.wma also
appears in Microsoft’s examples, as does a relative one. Inside a file pulled in with
ENTRYREF, the ENTRYREF’s URL is the base for relative
URLs.
Two special protocols address discs that allow it:
| Protocol | Example | Meaning |
|---|---|---|
wmpcd | wmpcd://0/4 | wmpcd://drive/track: the drive segment is the index of the CD drive (0 is the first) and track the track number; the example plays the fourth track in the first drive (Microsoft, WMPCD Protocol). |
wmpdvd | wmpdvd://f/5/3 | wmpdvd://drive/title/chapter?contentdir=path: the drive letter without the colon is always required; title and chapter are optional; contentdir is the folder that holds VIDEO_TS.IFO, and then the drive letter is ignored. wmpdvd://f/5/3 plays chapter 3 of title 5, if the DVD was authored to allow it (Microsoft, REF and WMPDVD Protocol). |
A REF can name still images (.gif, .jpg) and
Flash files (.swf) as well as audio and video. These need a
DURATION, or they have no length.
Scope and precedence
Several elements can appear at more than one level. The nearest one to the media wins.
| Element | Order of precedence |
|---|---|
DURATION | REF over ENTRY. DURATION also overrides PREVIEWDURATION. |
PREVIEWDURATION | REF over ENTRY, and either over ASX. The default is 10 seconds. |
STARTMARKER | REF over ENTRY. STARTMARKER also takes precedence over STARTTIME. |
ENDMARKER | REF over ENTRY. ENDMARKER also takes precedence over DURATION. |
BANNER | An ENTRY’s banner shows during that clip, in place of the ASX one. |
BASE | An ENTRY’s applies to that entry only, in place of the ASX one. |
Version 1.0: one line
The metafile pages say the Player “supports all previous versions of metafile syntax”
and do not describe them. The 1996-1998 NetShow metafile reference (saved from the MSDN
library disc) gives one example of a version 1.0 file, in a note about relative links: the
whole file is one line, the word ASF, a space and an address:
ASF http://mywebserver/metafiles/relativelink.asx
That note says the first file “can exist anywhere accessible to the user”, that a Web
page links to it, and that it points to a version 3.0 file with relative links. Nothing
else about version 1.0, or about a version 2.0, is in the pages read. The same reference’s
version 3.0 syntax (it says “For Microsoft Media Player version 3.0, the syntax version number
is 3.0. Microsoft Media Player 5.2 supports all previous versions”) lists LOGO
and DURATION among the children of ASX, and the pages read have no
LOGURL, SKIN or PARAM. The current reference has no
LOGO. In the NetShow reference it is <Logo href = "url" Style = "ICON" | "MARK" />
with both attributes required, a child of ASX or ENTRY: the
ICON graphic replaces the icon beside the show or clip title, the MARK
graphic (valid only under ASX) shows in the lower right corner of the video
area while the Player connects, and one of each style is allowed per element. The explorer
reads LOGO and says it is from that reference.
The [Reference] form
A Windows Media server can answer a plain HTTP request for a stream with a short INI-style
text file instead of the stream: the line [Reference], then lines
Ref1=, Ref2= … each with an address. Microsoft’s metafile pages do not
describe it. mpv’s source says why: the “ASF http streaming redirection” exists because the
http:// and mmsh:// protocols both use HTTP, “MMSH requires special http
headers to ‘activate’ it, and will in other cases return this playlist”; mpv then plays the same
address as mmsh:// when the media type is one of audio/x-ms-wax,
audio/x-ms-wma, video/x-ms-asf, video/x-ms-afs,
video/x-ms-wmv, application/x-mms-framed or
application/vnd.ms.wms-hdr.asfv1, and otherwise reads every line that starts with
Ref (any case), taking what follows the first =. VLC checks the first
line is exactly [Reference] and reads RefN= lines, turning
an http:// address into mmsh://; it reports any other line as
unexpected.
An example
<ASX VERSION="3.0" PREVIEWMODE="NO" BANNERBAR="AUTO">
<!-- Show information -->
<TITLE>Example Radio</TITLE>
<AUTHOR>Example Broadcasting</AUTHOR>
<COPYRIGHT>(c) Example Broadcasting</COPYRIGHT>
<MOREINFO HREF="https://radio.example.com/" TARGET="_blank"/>
<PARAM NAME="Encoding" VALUE="utf-8"/>
<!-- A clip with two addresses and a start point -->
<ENTRY CLIENTSKIP="NO">
<TITLE>Station ident</TITLE>
<REF HREF="mms://radio.example.com/ident.wma"/>
<REF HREF="https://backup.example.com/ident.wma"/>
<STARTTIME VALUE="0:05.0"/>
<DURATION VALUE="0:20.0"/>
</ENTRY>
<!-- Two clips, played three times -->
<REPEAT COUNT="3">
<ENTRY><REF HREF="song1.wma"/></ENTRY>
<ENTRYREF HREF="https://radio.example.com/more.asx"/>
</REPEAT>
</ASX>