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 | General metafile, traditionally pointing to .asf files | video/x-ms-asf |
.wax | Metafile for Windows Media Audio (.wma) | audio/x-ms-wax |
.wvx | Metafile for Windows Media Video (.wmv) | video/x-ms-wvx |
.wmx | Named by Microsoft alongside the other three as an extension for a referenced metafile | video/x-ms-wmx |
The media types are conventions rather than registered types, and
video/x-ms-asf is shared with ASF media files, so a server’s type does
not settle what a file is. Check for the <ASX opening instead.
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 | A track on a CD. Microsoft names the protocol but gives no address syntax on these pages. | |
wmpdvd | wmpdvd://f/5/3 | Chapter 3 of title 5 on a DVD, if the DVD was authored to allow it. |
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. |
The [Reference] form
Some servers answer with an INI-style text file instead of an ASX document: a line
[Reference], then lines such as
Ref1=http://example.com/stream. Microsoft’s metafile pages do not
describe it, so this is not part of the format above, but players meet it. mpv, for
one, recognises the exact [Reference] line and reads any key beginning
Ref.
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>