【问题标题】:could we convert a video file to all of this formats (swf,3gp,mp4, flv,ogv)?我们可以将视频文件转换为所有这些格式(swf、3gp、mp4、flv、ogv)吗?
【发布时间】:2014-04-29 00:11:54
【问题描述】:

考虑 user1 上传一个 swf 文件, user2上传了一个flv, 用户 3 上传一个 mp4 文件, 用户 4 上传 3gp 文件,

为了显示跨浏览器,我们需要上述格式的文件(swf、3gp、mp4、flv、ogv) 用户在 asp.net

中上传他/她的文件后如何做到这一点

感谢@Florestan06 我只是测试这段代码

    protected void Button1_Click(object sender, EventArgs e)
{
    string AppPath = Request.PhysicalApplicationPath;
    //This is the path of your application
    string inputPath = AppPath + "ffmpeg\\" + "tizer.mp4";
    //Source Video Path
    string outputPath = AppPath + "outputFolder\\" + "myVideoOutput.flv";
    //Destination Video Path
    string fileargs = " -i \"" + inputPath + "\" \"" + outputPath + "\"";
    //Command Line
    System.Diagnostics.Process proc = new System.Diagnostics.Process();
    proc.StartInfo.FileName = AppPath + "ffmpeg\\ffmpeg.exe";
    //Path of FFMPEG
    proc.StartInfo.Arguments = fileargs;
    proc.StartInfo.UseShellExecute = false;
    proc.StartInfo.CreateNoWindow = false;
    proc.StartInfo.RedirectStandardOutput = false;
    proc.Start();
}

它将 tizer.mp4 转换为 flv,但现在它的大小为 0 字节。你有什么想法吗?

【问题讨论】:

    标签: asp.net video converter


    【解决方案1】:

    我建议您在服务器上安装ffmpeg,然后调用ffmpeg commands through .NET。这样,您可以将输入文件的不同转码处理为所需的输出。这当然是在上传完成后。

    虽然我不确定为什么您需要同时拥有 SWF 和 FLV - FLV 应该足以满足基于闪存的环境?查看here 了解更多信息。

    编辑它将 tizer.mp4 转换为 flv,但现在它的大小为 0 字节。你有什么想法吗?

    首先,您需要了解 ffmpeg 的基础知识,以便将代码转换为您所针对的不同输出。您可以从here 开始,然后使用ffmpeg documentation 更深入地了解。首先确保您的命令在终端/命令提示符中有效。

    一旦没问题,我建议您详细说明 .Net/ffmpeg 脚本的输出,尝试捕获/记录该过程的任何主要步骤。我只是指出如何从.Net 执行外部程序的示例。我想你可以在 Stackoverflow 或 MSDN 社区上找到其他示例,如果这个示例没有按预期工作。

    输出文件为 0 字节表明您的 ffmpeg 命令无效,或者您的脚本执行 ffmpeg 存在问题。

    【讨论】:

      猜你喜欢
      • 2012-01-29
      • 2016-05-01
      • 2011-01-12
      • 2012-01-20
      • 2013-02-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-28
      相关资源
      最近更新 更多