可以在共享托管服务器中使用“ ffmpeg.exe”吗?

雷蒙德·墨菲(Raymond Morphy)

我曾经ffmpeg.exe将视频文件转换为,flv但在共享主机中不起作用。是否可以ffmpeg在共享主机中使用这是我的代码:

 private bool ReturnVideo(string fileName)
    {
        string html = string.Empty;
        //rename if file already exists

        int j = 0;
        string AppPath;
        string inputPath;
        string outputPath;
        string imgpath;
        AppPath = Request.PhysicalApplicationPath;
        //Get the application path
        inputPath = AppPath + "OriginalVideo";
        //Path of the original file
        outputPath = AppPath + "ConvertVideo";
        //Path of the converted file
        imgpath = AppPath + "Thumbs";
        //Path of the preview file
        string filepath = Server.MapPath("~/OriginalVideo/" + fileName);
        while (File.Exists(filepath))
        {
            j = j + 1;
            int dotPos = fileName.LastIndexOf(".");
            string namewithoutext = fileName.Substring(0, dotPos);
            string ext = fileName.Substring(dotPos + 1);
            fileName = namewithoutext + j + "." + ext;
            filepath = Server.MapPath("~/OriginalVideo/" + fileName);
        }
            this.fileuploadImageVideo.SaveAs(filepath);
        string outPutFile;
        outPutFile = "~/OriginalVideo/" + fileName;
        int i = this.fileuploadImageVideo.PostedFile.ContentLength;
        System.IO.FileInfo a = new System.IO.FileInfo(Server.MapPath(outPutFile));
        while (a.Exists == false)
        {

        }
        long b = a.Length;
        while (i != b)
        {

        }


        string cmd = " -i \"" + inputPath + "\\" + fileName + "\" \"" + outputPath + "\\" + fileName.Remove(fileName.IndexOf(".")) + ".flv" + "\"";
        ConvertNow(cmd);
        string imgargs = " -i \"" + outputPath + "\\" + fileName.Remove(fileName.IndexOf(".")) + ".flv" + "\" -f image2 -ss 1 -vframes 1 -s 280x200 -an \"" + imgpath + "\\" + fileName.Remove(fileName.IndexOf(".")) + ".jpg" + "\"";
        ConvertNow(imgargs);


        return true;
    }
    private void ConvertNow(string cmd)
    {
        string exepath;
        string AppPath = Request.PhysicalApplicationPath;
        //Get the application path
        exepath = AppPath + "ffmpeg.exe";
        System.Diagnostics.Process proc = new System.Diagnostics.Process();
        proc.StartInfo.FileName = exepath;
        //Path of exe that will be executed, only for "filebuffer" it will be "flvtool2.exe"
        proc.StartInfo.Arguments = cmd;
        //The command which will be executed
        proc.StartInfo.UseShellExecute = false;
        proc.StartInfo.CreateNoWindow = true;
        proc.StartInfo.RedirectStandardOutput = false;
        proc.Start();

        while (proc.HasExited == false)
        {

        }
    }
用户名

除非您在FullTrust上运行,否则无法实例化System.Diagnostics.Process对象。

此类包含适用于所有成员的类级别的链接需求和继承需求。当直接调用者或派生类不具有完全信任权限时,将引发SecurityException。

通常,托管提供程序不允许共享主机上的应用程序在“完全信任”下运行。请与您的支持人员联系以获取更多详细信息,或仅在服务器上运行您的代码。

要更改信任级别,请在web.config中进行设置

<trust level="Full" originUrl=""/>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

可以在共享主机服务器上使用Pelican吗?

我们可以在托管在 azure 服务器中的 rest api 中使用保留字吗

可以在我自己的服务器上托管电报吗?

Landscape可以监视托管在其上的服务器吗?

Firebase可以托管使用服务器端功能的Blazor应用吗?

网络托管服务器也可以成为域名服务器吗?

我可以在非托管Delphi EXE中使用托管C#DLL吗?

我可以在共享的Web服务器上使用go生成HTML吗?

我可以在生产服务器中使用flowplayer吗?它是免费的吗?

我可以使用托管提供商的SMTP服务器代替域名提供商吗?

我可以在服务器端发布/订阅中使用SNS吗?

您可以在graphql服务器架构文件中使用片段吗

我可以在webpack中使用node.js服务器模块吗?

我可以在Shiny中使用输出服务器作为新的Input参数吗?

我可以在Laravel刀片服务器的@unless中使用@ else / @ elseif吗?

我可以在esxi的家中使用机架安装服务器吗

我可以在工作线程中使用节点 http 服务器吗

TCP打孔后打开的端口上可以托管HTTP / HTTPS服务器吗?

您可以在Apple TV而不是外部服务器上托管TVJS文件吗?

可以使用VVC / VTM编码器/解码器支持编译ffmpeg吗?

您可以使用ffmpeg同时编辑多个视频吗?

我可以在VideoCriter类的OpenCV中使用ffmpeg的“流副本”吗?

如何使用 FFMpeg debayer bmp 图像?(.exe 文件)

kafka服务器可以强制使用方属性吗?

我可以直接从Linux服务器访问Windows共享并复制文件吗

Spark节点可以使用Spark-Cassandra Connector连接到托管在其他服务器中的Cassandra节点吗

PHPExcel:我们可以在商业网络服务器中使用它吗?

我可以在 nodejs 服务器的所有“.js”文件中使用 winston 日志记录功能吗?

在Node.js中使用Rickshaw / D3,对于服务器端,可以访问原始svg吗?