【问题标题】:In the using directive "using Accord.Video.FFMPEG", FFMPEG does not exist in the name space在 using 指令“using Accord.Video.FFMPEG”中,名称空间中不存在 FFMPEG
【发布时间】:2019-09-16 05:45:42
【问题描述】:

我正在 Visual Studio 中构建一个 Azure 函数来将视频帧转换为图像。我正在使用 Accord.Video.FFMPEG 类中的 VideoFileReader 类。该代码在我的机器上运行,但在尝试将其构建为 Azure 函数项目时,使用指令 Accord.Video.FFMPEG 错误。 随后找不到 VideoFileReader 类型。

我已尝试重新安装 Accord、Accord.Video 和 Accord.Video.FFMPEG NuGet 包。

using System.IO;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
using Accord;
using Accord.Video;
using Accord.Video.FFMPEG;

namespace ConvertVideo
{
    public static class Function1
    {
        [FunctionName("Function1")]
        public static void Run([BlobTrigger("videos/{name}", Connection = "AzureWebJobsStorage")]Stream myBlob, string name, ILogger log)
        {
            log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");

            //start a new videoFileReader
            using (var vFReader = new VideoFileReader())
            {
                //open the video
                vFReader.Open(name);
                //get the framerate
                double frameRate = vFReader.FrameRate.ToDouble();
                //more code which converts a frame to jpg
            }
        }   
    }
 }

【问题讨论】:

    标签: c# azure video ffmpeg azure-functions


    【解决方案1】:

    问题似乎是来自 Accord 的 FFMPEG dll 仅适用于 .Net 框架,不适用于 Azure 函数应用程序使用的 .Net Standard 或 .Net Core。 我不得不放弃 Function App 并改用 Azure Webjob。 Webjobs 可以使用 .Net 框架。

    【讨论】:

      【解决方案2】:

      如果你没有成功发布“Accord.Video.FFMPEG”到azure函数,你可以在Azure门户手动添加。

      1. 首先转到Azure门户上的功能并单击“平台功能”->“高级工具(Kudu)”(如下图所示)

      1. 然后点击“调试控制台”-->“CMD”-->“站点”-->“wwwroot”-->“新建文件夹”,将新文件夹命名为“bin”。(如下图所示)

      1. 下载“Accord.Video.FFMPEG”的nupkg,将nupkg中的dll文件从本地拖到上面创建的“bin”文件夹中。

      2. 然后在你的函数中使用它(如下截图所示)

      【讨论】:

      • 现在出现这个错误:“必须在应用于非 IJW 方法的 DllImport 属性中指定库名称”
      • 嗨@StewartMetcalfe,这篇文章可能会对您的问题有所帮助:stackoverflow.com/questions/51958187/…
      猜你喜欢
      • 2015-10-16
      • 2011-02-26
      • 2014-12-25
      • 1970-01-01
      • 2018-02-20
      • 1970-01-01
      • 2017-02-14
      • 1970-01-01
      相关资源
      最近更新 更多