简体   繁体   English

C#使用FFMpegConverter进行视频连接

[英]C# Video concatenation using FFMpegConverter

I need to implement video concatenation in my ASP.NET Web API. 我需要在ASP.NET Web API中实现视频连接。 I could successfully concatenate some sample videos downloaded from internet using 'FFMpegConverter' Nuget Package . 我可以使用'FFMpegConverter'Nuget Package成功连接从互联网下载的一些示例视频。 But when I tried concatenating files captured from my mobile and tried opening it, I got the following error. 但是,当我尝试连接从我的手机捕获的文件并尝试打开它时,我收到以下错误。 在此输入图像描述

Below is the code snippet I'm using: 以下是我正在使用的代码段:

var ffMpeg = new NReco.VideoConverter.FFMpegConverter();
ffMpeg.ConcatMedia(_fileNames, videoRootPath.mp4, 
                   NReco.VideoConverter.Format.mp4, set);

These are the Property screenshots of both the mp4 files. 这些是mp4文件的属性屏幕截图。

在此输入图像描述

Thanks in advance 提前致谢

I got correct output by making the following changes to the code 通过对代码进行以下更改,我得到了正确的输出

  var ffMpeg = new NReco.VideoConverter.FFMpegConverter();
                NReco.VideoConverter.ConcatSettings set = new NReco.VideoConverter.ConcatSettings();
                ffMpeg.ConcatMedia(_fileNames, videoRootPath + tobename + ".mp4", NReco.VideoConverter.Format.mp4, set);

NReco.VideoConverter.ConcatSettings had to be initialised with default values. 必须使用默认值初始化NReco.VideoConverter.ConcatSettings。 This should have been the fourth parameter to "ffMpeg.Concatmedia" method. 这应该是“ffMpeg.Concatmedia”方法的第四个参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM