【问题标题】:Azure Media Service using IAssetFile in taskAzure 媒体服务在任务中使用 IAssetFile
【发布时间】:2017-04-04 02:11:45
【问题描述】:

我想知道我是否可以使用 AssetFile 添加到任务中?我有这个流程:

  1. 将视频编码为多种分辨率。
  2. 用 360p 分辨率视频制作摘要。

我知道 IAsset 的 Id 并成功获取了 360p 分辨率视频的 IAssetFile。但是,我不能使用它,因为该任务需要 IAsset 而不是 IAssetFile。

这是我的示例代码:

        IJob job = _MediaServicesContext.Jobs.Create("Video Thumbnail Job");

        string MediaProcessorName = "Azure Media Video Thumbnails";

        var processor = GetLatestMediaProcessorByName(MediaProcessorName);

        IAsset curretAsset = _MediaServicesContext.Assets.Where(a => a.Id == request.AssetId).FirstOrDefault();

        IAssetFile file360 = curretAsset.AssetFiles.Where(f => f.Name.EndsWith("360_500.mp4")).FirstOrDefault();

        String configuration = "{\"version\":\"1.0\",\"options\":{\"outputAudio\" : \"false\", \"maxMotionThumbnailDurationInSecs\": \"10\", \"fadeInFadeOut\" : \"false\" }}";

        // Create a task with the encoding details, using a string preset.
        ITask task = job.Tasks.AddNew("My Video Thumbnail Task",
            processor,
            configuration,
            TaskOptions.None);

        // Specify the input asset.
        task.InputAssets.Add(file360);

        // Specify the output asset.

        task.OutputAssets.AddNew(curretAsset.Id.ToString() + " Summarized", AssetCreationOptions.None);

        // Use the following event handler to check job progress.  
        job.StateChanged += new EventHandler<JobStateChangedEventArgs>(StateChanged);

        // Launch the job.
        job.Submit();

        // Check job execution and wait for job to finish.
        Task progressJobTask = job.GetExecutionProgressTask(CancellationToken.None);

        progressJobTask.Wait();

谢谢

【问题讨论】:

    标签: c# .net azure azure-media-services


    【解决方案1】:

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-09-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-28
    • 1970-01-01
    相关资源
    最近更新 更多