How to apply effects to captured video (HTML)

Applies to Windows and Windows Phone

Use the MediaCapture.AddEffectAsync method to apply effects to captured video.

Effects can be a built-in effect, such as the VideoStabilization effect which is supported on Windows or the SlowMotionEffectDefinition which is supported on Windows Phone, or custom effects which are Media Foundation Transforms (MFTs). For information about how to create and use MFTs, see Media Foundation Transforms and the Media Extension Sample.

Objective: This tutorial describes how to apply effects to captured video.

Prerequisites

This topic assumes that you can create a basic Windows Runtime app using JavaScript. For help creating your first app, see Create your first Windows Store app using JavaScript.

Instructions

To add an effect to captured video, call the AddEffectAsync method. This method takes the following parameters:

  • MediaStreamType - One of the values of the MediaStreamType enumeration that specifies whether the stream is for video recording, video preview, audio, or photo.
  • effectActivationID - The class identifier of the activatable runtime class that implements the effect. This parameter is added to the chain of effects that get added to the source stream coming out of the device source. The runtime class must implement the IMediaExtension interface.
  • effectSettings - An IPropertySet that contains additional configuration parameters for the effect. If no additional configuration is needed for the effect, then this parameter should be null.

The application can call this method multiple times to add several effects.

This example calls AddEffectAsync to add the VideoStabilization effect to a MediaCapture object.


    // captureMgr is a MediaCapture object defined elsewhere
    capturMgr.addEffectAsync(
        Windows.Media.Capture.MediaStreamType.videoRecord,
        "Windows.Media.VideoEffects.VideoStabilization",
        null);


  • Applies to Windows Phone

Note  This example uses the VideoStabilizationEffect, which is not supported for Windows Phone, but AddEffectAsync can be used to add other, supported effects.

Summary

For another example of how to apply an effect to video, see the How to add video stabilization topic and the Media Capture Sample.

Related topics

Media Capture Sample
Media Extension Sample

 

 

Show:
© 2014 Microsoft