Video​Media​Frame Video​Media​Frame Video​Media​Frame Class

Definition

Represents a frame from a MediaFrameSource that provides data in an video frame represented by a IDirect3DSurface or SoftwareBitmap.

public : sealed class VideoMediaFrame : IVideoMediaFramepublic sealed class VideoMediaFrame : IVideoMediaFramePublic NotInheritable Class VideoMediaFrame Implements IVideoMediaFrame
Attributes
Windows 10 requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

Remarks

Get an instance of this class by accessing the VideoMediaFrame property of a MediaFrameReference object that was obtained from a media frame source.

Important

If you access the SoftwareBitmap or Direct3DSurface objects provided by the VideoMediaFrame property of a MediaFrameReference, the system creates a strong reference to these objects, which means that they will not be disposed when you call Dispose on the containing MediaFrameReference. You must explicitly call the Dispose method of the SoftwareBitmap or Direct3DSurface directly for the objects to be immediately disposed. Otherwise, the garbage collector will eventually free the memory for these objects, but you can't know when this will occur, and if the number of allocated bitmaps or surfaces exceeds the maximum amount allowed by the system, the flow of new frames will stop.

For how-to guidance on using MediaFrameSource to capture frames, see Process media frames with MediaFrameReader.

Properties

CameraIntrinsics CameraIntrinsics CameraIntrinsics

Gets an object that describes the distortion model of the camera that generated the VideoMediaFrame.

public : CameraIntrinsics CameraIntrinsics { get; }public CameraIntrinsics CameraIntrinsics { get; }Public ReadOnly Property CameraIntrinsics As CameraIntrinsics
Value
CameraIntrinsics CameraIntrinsics CameraIntrinsics

An object that describes the distortion model of the camera that generated the VideoMediaFrame.

Attributes

DepthMediaFrame DepthMediaFrame DepthMediaFrame

Gets a DepthMediaFrame containing depth data for the VideoMediaFrame, if the frame contains depth data.

public : DepthMediaFrame DepthMediaFrame { get; }public DepthMediaFrame DepthMediaFrame { get; }Public ReadOnly Property DepthMediaFrame As DepthMediaFrame
Attributes

Remarks

If the MediaFrameSource that generated the VideoMediaFrame does not produce depth data, this object is null.

Direct3DSurface Direct3DSurface Direct3DSurface

Gets an IDirect3DSurface object containing the image data for the VideoMediaFrame.

public : IDirect3DSurface Direct3DSurface { get; }public IDirect3DSurface Direct3DSurface { get; }Public ReadOnly Property Direct3DSurface As IDirect3DSurface
Value
IDirect3DSurface IDirect3DSurface IDirect3DSurface

An IDirect3DSurface object containing the image data for the VideoMediaFrame.

Attributes

Remarks

If you initialize a MediaCapture object to use CPU memory for captured frames by setting the MemoryPreference property of the MediaCaptureInitializationSettings to Cpu, the Direct3DSurface property of a received VideoMediaFrame will be null and the SoftwareBitmap property will be non-null and contain the image data from the frame. Setting the memory preference to Auto allows the system to choose the optimal memory location for the current device. If the system chooses to use GPU memory, the SoftwareBitmap property will be null and the Direct3DSurface property will contain the frame's image data..

FrameReference FrameReference FrameReference

Gets the MediaFrameReference wrapper object associated with the VideoMediaFrame, which provides access to format information and other properties of the media frame.

public : MediaFrameReference FrameReference { get; }public MediaFrameReference FrameReference { get; }Public ReadOnly Property FrameReference As MediaFrameReference
Attributes

InfraredMediaFrame InfraredMediaFrame InfraredMediaFrame

Gets an InfraredMediaFrame containing depth data for the VideoMediaFrame, if the frame contains infrared data.

public : InfraredMediaFrame InfraredMediaFrame { get; }public InfraredMediaFrame InfraredMediaFrame { get; }Public ReadOnly Property InfraredMediaFrame As InfraredMediaFrame
Attributes

Remarks

If the MediaFrameSource that generated the VideoMediaFrame does not produce infrared data, this object is null.

SoftwareBitmap SoftwareBitmap SoftwareBitmap

Gets a SoftwareBitmap object containing the image data for the VideoMediaFrame.

public : SoftwareBitmap SoftwareBitmap { get; }public SoftwareBitmap SoftwareBitmap { get; }Public ReadOnly Property SoftwareBitmap As SoftwareBitmap
Value
SoftwareBitmap SoftwareBitmap SoftwareBitmap

A SoftwareBitmap object containing the image data for the VideoMediaFrame.

Attributes

Remarks

Initialize a MediaCapture object to use CPU memory for captured frames by setting the MemoryPreference property of the MediaCaptureInitializationSettings to Cpu. Doing this guarantees that the SoftwareBitmap property of a received VideoMediaFrame will be non-null and contain the image data from the frame. Setting the memory preference to Auto allows the system to choose the optimal memory location for the current device. If the system chooses to use GPU memory, the SoftwareBitmap property will be null and the Direct3DSurface property should be used instead.

VideoFormat VideoFormat VideoFormat

Gets an object describing the format of the VideoMediaFrame image data.

public : VideoMediaFrameFormat VideoFormat { get; }public VideoMediaFrameFormat VideoFormat { get; }Public ReadOnly Property VideoFormat As VideoMediaFrameFormat
Value
VideoMediaFrameFormat VideoMediaFrameFormat VideoMediaFrameFormat

An object describing the format of the VideoMediaFrame image data.

Attributes

Methods

GetVideoFrame() GetVideoFrame() GetVideoFrame()

Creates a copy of the VideoMediaFrame as a VideoFrame object.

public : VideoFrame GetVideoFrame()public VideoFrame GetVideoFrame()Public Function GetVideoFrame() As VideoFrame
Returns

The VideoFrame containing a copy of the VideoMediaFrame image data.

Attributes

See Also