C# 在ffmpeg m4s到mp4传输上处理输入时发现无效数据
我在这里看到了一篇关于将m4s转换为mp4的帖子,我遵循了将所有文件连接到另一个m4s文件的步骤,我称之为all.m4s,当我使用命令ffmpeg-I allm4s.m4s-c copy video.mp4时。我通过编码一个exe将所有包含单词video的m4s文件添加到m4s文件中,生成了组合的m4s文件。这是用c写的源代码,如果你编译了代码,那就是我用来制作m4s的代码C# 在ffmpeg m4s到mp4传输上处理输入时发现无效数据,c#,ffmpeg,file-extension,file-format,C#,Ffmpeg,File Extension,File Format,我在这里看到了一篇关于将m4s转换为mp4的帖子,我遵循了将所有文件连接到另一个m4s文件的步骤,我称之为all.m4s,当我使用命令ffmpeg-I allm4s.m4s-c copy video.mp4时。我通过编码一个exe将所有包含单词video的m4s文件添加到m4s文件中,生成了组合的m4s文件。这是用c写的源代码,如果你编译了代码,那就是我用来制作m4s的代码 using System; using System.Collections.Generic; using System.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace files
{
class Program
{
static void Main(string[] args)
{
string dir = Directory.GetCurrentDirectory();
string[] info = Directory.GetFiles(dir);
Console.WriteLine(dir + "\\allm4s.m4s");
Console.ReadKey();
foreach (string name in info)
{
if (Path.GetFileName(name).Contains(".m4s") && Path.GetFileName(name).Contains("video"))
{
using (Stream srcStream = File.OpenRead(name))
{
using (Stream destStream = File.OpenWrite(dir+"\\allm4s.m4s"))
{
srcStream.CopyTo(destStream);
Console.WriteLine(destStream+name);
}
}
}
}
Console.ReadKey();
}
}
}
我认为如果有问题的话,应该是这个allm4s.m4s文件,因为文件大小约为1.5mb,即使每个段m4s约为750kb,并且有很多。如果有人有一种方法可以通过一个程序/应用程序将大量文件连接在一起,这将是非常有用的。您之所以会遇到这个错误,是因为您可能是连接不同维度的视频。 所有输入文件的全名都存储在输入数组中 Java程序
String inputStr="";
String stream="";
for(int index=0;index<input.length;index++){
inputStr=inputStr+" -i "+input[index];
stream =stream +"["+index+":v]"+"["+index+":a]"; //gets audio and video stream of file
}
String command = "ffmpeg "+inputStr+" -filter_complex \" "+stream+" concat=n="+(index-1)+ \
":v=1:a=1 [v] [a] \" "+ "-map \"[v]\" -map \"[a]\" outputfile.m4s"
Runtime.getRuntime(command).exec().waitFor();//runs ffmpeg command to concat all files
String inputStr=”“;
字符串流=”;
对于(int index=0;index)错误并不表示中断的输入是由于连接了不同的维度造成的。其次,问题被标记了,因此java解决方案可能没有帮助。