在处理 ffmpeg m4s 到 mp4 传输的输入时发现无效数据
Invalid data found when processing input on ffmpeg m4s to mp4 transfer
The result of the power shell window
我在这里看到了关于将 m4s 转换为 mp4 的 post,并且我按照以下步骤将所有文件连接到另一个我称为 all.m4s 的 m4s 文件中,当我使用命令 ffmpeg -i 时allm4s.m4s -c 复制视频.mp4。我通过编写一个 exe 来将所有包含单词视频的 m4s 文件添加到 m4s 文件中,从而制作了组合的 m4s 文件。这是用 c# 编写的源代码,如果你编译代码,那就是我用来制作 m4s 的代码
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,并且有相当多的 lot.If 任何人都有办法通过 program/application 将大量文件连接在一起,这很有用。
您收到该错误是因为您可能正在串联不同尺寸的视频。
所有输入文件的全名都存储在输入数组
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
The result of the power shell window
我在这里看到了关于将 m4s 转换为 mp4 的 post,并且我按照以下步骤将所有文件连接到另一个我称为 all.m4s 的 m4s 文件中,当我使用命令 ffmpeg -i 时allm4s.m4s -c 复制视频.mp4。我通过编写一个 exe 来将所有包含单词视频的 m4s 文件添加到 m4s 文件中,从而制作了组合的 m4s 文件。这是用 c# 编写的源代码,如果你编译代码,那就是我用来制作 m4s 的代码
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,并且有相当多的 lot.If 任何人都有办法通过 program/application 将大量文件连接在一起,这很有用。
您收到该错误是因为您可能正在串联不同尺寸的视频。 所有输入文件的全名都存储在输入数组
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