【发布时间】:2016-10-18 08:12:10
【问题描述】:
我正在尝试使用 Nreco.videoconverter ffmpeg 包装器从一系列 .jpg 文件制作视频。我在这个论坛上搜索答案,几乎对我有帮助的主题是
http://stackoverflow.com/questions/15280199/how-to-make-a-video-file-from-images
如果您已经有图像文件,最好的方法是使用特殊的 "image2" 格式(FFMpeg demuxer)和 FFMPeg 将直接读取文件 用于制作视频 VideoConverter支持实时流转换,可以实时制作视频。在这种情况下,“rawvideo”应该是 指定为输入格式和 C# 应用程序应传递 RAW 位图 字节(如问题中所述)作为实时流的输入 转换器。
我尝试使用此代码,但我总是得到 1 帧的视频(数组中的第一个):
NReco.VideoConverter.FFMpegConverter c = new FFMpegConverter();
ConcatSettings set = new ConcatSettings();
set.VideoFrameRate = 5;
set.VideoFrameCount = 10;
set.ConcatVideoStream = true;
set.ConcatAudioStream = false;
set.SetVideoFrameSize(704, 576);
string[] _fileNames = new string[25];
_fileNames[0] = "g:\\Storage\\001.jpg";
_fileNames[1] = "g:\\Storage\\002.jpg";
_fileNames[2] = "g:\\Storage\\003.jpg";
_fileNames[3] = "g:\\Storage\\004.jpg";
_fileNames[4] = "g:\\Storage\\005.jpg";
_fileNames[5] = "g:\\Storage\\006.jpg";
_fileNames[6] = "g:\\Storage\\007.jpg";
_fileNames[7] = "g:\\Storage\\008.jpg";
_fileNames[8] = "g:\\Storage\\009.jpg";
_fileNames[9] = "g:\\Storage\\010.jpg";
c.ConcatMedia(_fileNames, "g:\\Storage\\test2.mp4", Format.mp4, set);
我也尝试使用 ConvertMedia() 方法代替 ConcatMedia,但结果相同。
有没有办法告诉转换器这是一个图像序列?
还有其他 FFMPEG 包装器或方法可以做到这一点吗?
我发现 AForge 类很好,但仅适用于 .NET 3.5
Tnx!
【问题讨论】:
标签: c# video-conversion