---
title: "WMReader Class"
canonical: https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_WMReader.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# WMReader Class
 
This class is used to read frames from video files using Windows Media framework.
 
**Namespace:** [Aurigma.GraphicsMill.Codecs](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md)
 **Assembly:** Aurigma.GraphicsMill.Codecs.MediaProcessor (in Aurigma.GraphicsMill.Codecs.MediaProcessor.dll)
 
## Syntax
  
```
Public NotInheritable Class WMReader _Inherits FormatReader _Implements IFrameEnumerator, IMediaProcessorMetadataReadSupport, ITimeReader
```
 
```csharp
public sealed class WMReader : FormatReader, IFrameEnumerator, IMediaProcessorMetadataReadSupport, ITimeReader
```
 
## Remarks
  
Windows Media is intended to work with the ASF, WMV, WMA and MP3 formats. Therefore, this framework is recommended to use when reading files of these types. Compared to other frameworks, Windows Media provides a better support of ID3 metadata. For the list of supported file formats, see the [System Requirements](https://www.graphicsmill.com/docs/gm5/MediaProcessorSystemRequirements.htm.md) section of the manual.
 
Video files are represented as a sequence of images which are called *frames*. The WMReader class allows extracting frames using the [LoadFrame(Int32)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_FormatReader_LoadFrame_1_e1836fc4.htm.md) method. Also, the reader object can be interpreted as a collection of frames, and therefore the frames can be enumerated using the `foreach` statement.
 
A WMReader object can be used not only to read video data, but also to extract some information about the opened file. For example, you can get:
 
- Duration (the [Duration](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_WMReader_Duration.htm.md) property).
- Number of frames per second (the [FramesPerSecond](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_WMReader_FramesPerSecond.htm.md) property).
- Collection of metadata (the [Metadata](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_WMReader_Metadata.htm.md) property).

In general the reader usage workflow should be as follows:
 
1. Create a WMReader instance.
2. Open the reader using the [Open(String)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_FormatReader_Open_1_bb3a7a4f.htm.md) method. 
**Note**
You cannot get any data from the reader until you open it on some file.
3. If necessary, read the [Duration](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_WMReader_Duration.htm.md), [Metadata](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_WMReader_Metadata.htm.md) and [FramesPerSecond](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_WMReader_FramesPerSecond.htm.md) properties.
4. Iterate through each frame in the reader using the [LoadFrame(Int32)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_FormatReader_LoadFrame_1_e1836fc4.htm.md) method. It will return a [WMFrame](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_WMFrame.htm.md) class instance. To extract the image from the frame, use the [GetBitmap(Bitmap)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_Frame_GetBitmap_1_fd4033ef.htm.md) method.
 
    To get the total number of the frames in the reader, read the [FrameCount](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_FormatReader_FrameCount.htm.md) property.
 
## Examples
 This example shows the general pattern of working with the reader. ```
Private Sub WMReaderUsage(ByVal aPath As String)
    Dim aReader As WMReader = New WMReader(aPath)
    'Work with the reader
    aReader.Dispose()
End Sub
``````csharp
private void WMReaderUsage(String aPath)
{
    WMReader aReader = new WMReader(aPath);
    //Work with the reader
    aReader.Dispose();
}
```
 
## Inheritance Hierarchy
  
- [System.Object](http://msdn2.microsoft.com/en-us/e5kfa45b)
    - [Aurigma.GraphicsMill.SyncHandler](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_SyncHandler.htm.md)
        - [Aurigma.GraphicsMill.Codecs.FormatReader](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_FormatReader.htm.md)
            - Aurigma.GraphicsMill.Codecs.WMReader
 
## Thread Safety
 Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.
 
## Object Model

[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill.Codecs.MediaProcessor_ObjectModel_18.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_WMReader.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill.Codecs.MediaProcessor_ObjectModel_8.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_IFrame.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill.Codecs.MediaProcessor_ObjectModel_9.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_IFrame.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel2.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill.Codecs.MediaProcessor_ObjectModel_11.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_IFrame.htm.md)
![](https://www.graphicsmill.com/docs/gm5/ObjectModel1.png)[![](https://www.graphicsmill.com/docs/gm5/Aurigma.GraphicsMill.Codecs.MediaProcessor_ObjectModel_17.png)](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_MediaProcessorMetadataDictionary.htm.md)
  
## See Also

### Reference

- [WMReader Members](https://www.graphicsmill.com/docs/gm5/AllMembers_T_Aurigma_GraphicsMill_Codecs_WMReader.htm.md)
- [Aurigma.GraphicsMill.Codecs Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md)
