Quick Introduction to ASF,ASX, and Networking Media Distribution

Have you ever wondered how to code for distributing media files over a network? S. Balaji provides some examples.

Contributed by
Rating: 4 stars4 stars4 stars4 stars4 stars / 28
February 08, 2005
Rate this Article:
MEH MEH++


SEARCH ASP FREE
TOOLS YOU CAN USE

advertisement

The distribution of media files (audio and video files) over a network is the process of delivering (streaming) an audio or video stream from one server to another.

Distribution serves many purposes, such as:

  1. Distributing a stream to another server. 
  2. Distributing a stream to a server that is enabled for HTTP streaming. This allows users behind a firewall to receive a stream. 
  3. Distributing a stream from one Windows Media Server to another Windows Media Server.

Advanced Streaming Format (ASF):

Media file distribution can be done by using the Advanced Streaming format (ASF). ASF is a data format for streaming audio and video content, images, and script commands in packets over a network with a small time delay before playback begins.

NetShow Encoder (a part of Windows Media Tools) is used to convert media files (like AVI, WAV and MPG) to ASF.  Users can select a codec (Compressor/Decompressor) based on the audio, image quality, and image size. Other third-party tools are also available, like Zealot Software’s All Video Converter (http://www.zealotsoft.net/).

ASF Stream Redirector (.asx) file:

The metafile (.asx) is a simple text file. It is easily created and edited with a text editor such as Notepad. This file is saved with the file extension “.asx”. Other types of metafilers are “.wax” and “.wvx”. “.wax” is used for pure audio stream with “.wma” file extension. “.wvx” is used for video stream with “.wmv” file extension.

An ASX metafile can provide the following information:

  1. The location of the media file (.asf) on the Network.
  2. The Title, Author, Description and Copyright
    information of the media file.
  3. The rules for protocol rollover.
  4. The play list.

Sample “.asx” metafiles:

Sample 1 (Simple metafile):

<asx version=”3.0”>
<entry>
<ref href=”http://servername/path/asf-file1.
asf” />
</entry>
</asx>

Explanation:

<asx version=”3.0”> … </asx>
-- Shows the version number of the metafile.
<entry> … </entry>
--Shows the individual media file detail.
<ref href=”…” />
-- Shows the location of the media file.

Sample 2 (Simple metafile with Title, Author and Copyright):

<asx version=”3.0”>
<entry>
<title> Title of the file </title>
<author> Author of the file </author>
<copyright> Copyright information </
copyright>
<ref href=”http://servername/path/asf-file1.
asf” />
</entry>
</asx>

Explanation:

<title> … </title>
-- Displays the Title of the clip in the Clip and Title bar of the Windows Media Player.
<author> … </author>
-- Displays the Author name in Windows Media Player author column.
<copyright> … </copyright>
-- Shows the Copyright information in Windows Media Player Copyright column.

Sample 3 (Metafile with Playlist):

<asx version=”3.0”>
<entry>
<title> Title of the file 1 </title>
<author> Author of the file 1 </author>
<copyright> Copyright information 1 </copyright>
<ref href=”http://servername/path/asf-file1.asf” />
</entry>
<entry>
<title> Title of the file 2 </title>
<author> Author of the file 2 </author>
<copyright> Copyright information 2 </copyright>
<ref href=”http://servername/path/asf-file2.asf” />
</entry>
</asx>
<asx version=”3.0”>
<title> Title of the files </title>
<author> Author of the files </author>
<copyright> Copyright information </copyright>
<entry>
<ref href=”http://servername/path/asf-file1.asf” />
</entry>
<entry>
<ref href=”http://servername/path/asf-file2.asf” />
</entry>
</asx>

Sample 4 (Advanced ASX file - Protocol rollover):

[Reference]
Ref1=http://servername/path/asf-file1.asf
Ref2= mms://servername/path/asf-file1.asf
BaseURL = http://servername/path/

[Description]
Program Title=Title of the ASF file
Program Description=Description of the ASF file
Program Author=Author name
Program Copyright=Copyright

Explanation:

Ref1 – First reference to try (HTTP Server).
Ref2 – Second reference to try (NetShow Server).
BaseURL – Base URL (Basic Path) for relative references in the ASF stream to use this as a base path.

ASF path:

Path should be one of the following:

mms://servername/path/asf-file1.asf
- NetShow server path. 
http://servername/path/asf-file1.asf
- HTTP server path.
file://\\servername\path\asf-file1.asf
- Network server path.
File://c:\path\asf-file1.asf
- Fixed drive path / Hard drive path.

How to Link the ASX File to Web Pages

Test ASX file by clicking it. If you are able to play your media file, you have configured it correctly.

You can also add a link to your Web page that points to the ASX file.

Sample Code:

Add this code to your Web page:

<a href=”http://servername/path/asx-file1.asx”>
Click here to start Windows Media Presentation </a>

ASF file can be linked directly to the Web page.

<embed src=”http://servername/path/asf-file1.asf” width=”176”
height=”154” controls=”playbutton” autostart=”true”>

(This article originally appeared in the September 2004 issue of Plug-in). 

blog comments powered by Disqus
CODE EXAMPLES ARTICLES

- Bipartite Graphs
- Connectivity in Graphs
- The Ford-Fulkerson Algorithm
- Critical Paths
- The Bellman-Ford and Roy-Floyd Algorithms
- Shortest Path Algorithms in Graphs
- Minimum Spanning Tree
- Articulation Edges and Vertexes
- Circles and Connectivity in Graphs
- Depth-First Search in Graphs
- Breadth-First Search in Graphs
- The Prufer Code and the Floyd-Warshall Algor...
- An Insight into Graphs
- Coding a Custom Object with WSC
- Creating a Custom Object with WSC

ASP Web Hosting ASP.Net Web Hosting Windows Web Hosting
ASP Free Forums 
 RSS  Tutorials RSS
 RSS  Forums RSS
 RSS  All Feeds
Site Map 
Request Media Kit
Write For Us Get Paid 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Privacy Policy 
Support 


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 10 - Follow our Sitemap
Most Popular Topics
All ASP.Net Tutorials