如何:获取媒体处理器实例How to: Get a Media Processor instance

概述Overview

在媒体服务中,媒体处理器是完成特定处理任务(例如,对媒体内容进行编码、格式转换、加密或解密)的组件。In Media Services a media processor is a component that handles a specific processing task, such as encoding, format conversion, encrypting, or decrypting media content. 通常,创建一个任务以便对媒体内容进行编码、加密或格式转换时,就需要创建一个媒体处理器。You typically create a media processor when you are creating a task to encode, encrypt, or convert the format of media content.

Azure 媒体处理器Azure media processors

以下主题提供媒体处理器列表:The following topic provides lists of media processors:

获取媒体处理器Get Media Processor

以下方法演示了如何获取媒体处理器实例。The following method shows how to get a media processor instance. 该代码示例假设使用名为 _context 的模块级变量引用服务器上下文,如如何: 以编程方式连接到媒体服务一节所述。The code example assumes the use of a module-level variable named _context to reference the server context as described in the section How to: Connect to Media Services Programmatically.

private static IMediaProcessor GetLatestMediaProcessorByName(string mediaProcessorName)
{
    var processor = _context.MediaProcessors.Where(p => p.Name == mediaProcessorName).
    ToList().OrderBy(p => new Version(p.Version)).LastOrDefault();

    if (processor == null)
    throw new ArgumentException(string.Format("Unknown media processor", mediaProcessorName));

    return processor;
}

媒体服务学习路径Media Services learning paths

媒体服务 v3(最新版本)Media Services v3 (latest)

查看最新版本的 Azure 媒体服务!Check out the latest version of Azure Media Services!

媒体服务 v2(旧版)Media Services v2 (legacy)

后续步骤Next Steps

了解如何获取媒体处理器实例后,请转到如何对资产进行编码主题,其中说明了如何使用 Media Encoder Standard 对资产进行编码。Now that you know how to get a media processor instance, go to the How to Encode an Asset topic which will show you how to use the Media Encoder Standard to encode an asset.