ffmpeg设置转换时的持续时间

ffmpeg设置转换时的持续时间,ffmpeg,Ffmpeg,我正在用ffmpeg转换视频,对话后的持续时间显示为00:00:00.00。 以下是我的论点 "-i " + FileName + " -ar 22050 -b 500k -f flv -t " + Duration + " " + outputfile 由我的代码呈现给 -i 1.mov -ar 22050 -b 500k -f flv -t 00:03:34.99 1.flv 我错过了什么 我试过了,没有效果,持续时间还是0。其中“outputfile”是我转换的文件,没有持续时间我在

我正在用ffmpeg转换视频,对话后的持续时间显示为00:00:00.00。 以下是我的论点

"-i " + FileName + " -ar 22050 -b 500k -f flv -t " + Duration + " " + outputfile
由我的代码呈现给

-i 1.mov -ar 22050 -b 500k -f flv -t 00:03:34.99 1.flv
我错过了什么



我试过了,没有效果,持续时间还是0。其中“outputfile”是我转换的文件,没有持续时间

我在刚刚运行的测试中看到了相同的问题。这似乎是ffmpeg中的一个已知问题。对于flv,它不能正确写入所有元数据,包括持续时间。您可以使用修复元数据。只需运行:

flvtool2 -UP file.flv
它将根据时间戳自动查找持续时间,并将元数据写入文件。我刚试过,效果很好。

我已经解决了我的问题

static void Fix(string Path)
        {
            string spath;
            spath = AppDomain.CurrentDomain.BaseDirectory;
            string filargs = "-U " + Path;
            Process proc1 = new Process();
            proc1.StartInfo.FileName = spath + "flvtool2.exe";
            proc1.StartInfo.Arguments = filargs;
            proc1.StartInfo.UseShellExecute = false;
            proc1.StartInfo.CreateNoWindow = false;
            proc1.StartInfo.RedirectStandardOutput
= false;
            proc1.Start();
            proc1.WaitForExit();
            proc1.Close();
        }

它做得很好

您是否检查了您通过它的持续时间是否正确(以秒或hh:mm:ss[.xxx])?输出文件是否正确播放,只是报告了不正确的持续时间,还是根本不播放?你能从命令行尝试同样的命令并将ffmpeg的输出粘贴到这里吗?这是我的确切命令-i 1.mov-ar 22050-b 500k-f flv-t 00:03:34.99 1.flv对话成功进行,但一些玩家看不到搜索线路被禁用的持续时间。
static void Fix(string Path)
        {
            string spath;
            spath = AppDomain.CurrentDomain.BaseDirectory;
            string filargs = "-U " + Path;
            Process proc1 = new Process();
            proc1.StartInfo.FileName = spath + "flvtool2.exe";
            proc1.StartInfo.Arguments = filargs;
            proc1.StartInfo.UseShellExecute = false;
            proc1.StartInfo.CreateNoWindow = false;
            proc1.StartInfo.RedirectStandardOutput
= false;
            proc1.Start();
            proc1.WaitForExit();
            proc1.Close();
        }