Nreco视频转换器从图像序列制作视频 [英] Nreco video converter make video from image sequence

查看:74
本文介绍了Nreco视频转换器从图像序列制作视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Nreco.videoconverter ffmpeg包装器从一系列.jpg文件制作视频.我在这个论坛和主题中寻找对我几乎有帮助的答案

I'm trying to make a video from a sequence of .jpg files using Nreco.videoconverter ffmpeg wrapper. I search for answer on this forum and topic that almost help me is

http://stackoverflow.com/questions/15280199/how-to-make-a-video-file-from-images

如果您已经有图像文件,最好的方法是使用特殊文件"image2"格式(FFMpeg多路分解器)和FFMPeg将直接读取文件用于制作视频通过VideoConverter支持的实时流转换可以实时制作视频.在这种情况下,"rawvideo"应为指定为输入格式,并且C#应用程序应传递RAW位图字节(如问题中所述)作为实时流的输入转换器.

If you already have image files the best way is using special "image2" format (FFMpeg demuxer) and FFMPeg will read files directly for producing video Video can be produced in real-time with live stream conversion supported by VideoConverter. In this case "rawvideo" should be specified as input format and C# application should pass RAW bitmap bytes (as mentioned in the question) as input for live stream converter.

我尝试使用此代码,但是我总是获得1帧的视频(数组中的第一个):

I try with this code but I always get video with 1 frame (the first one from array):

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,但结果相同.

I also try to use ConvertMedia() method instead ConcatMedia but with same result.

有什么办法告诉转换器这是图像序列吗?

Is there any way to tell converter this is a sequence of images ?

还有其他FFMPEG包装器或方法吗?

Is there any other FFMPEG wrraper or way to do this ?

我发现AForge类不错,但仅适用于.NET 3.5

I found AForge class which is good but working only with .NET 3.5

Tnx!

推荐答案

FFMpegConverter.ConcatMedia使用concat过滤器合并多个视频文件,不应用于对图像中的视频进行编码.

FFMpegConverter.ConcatMedia uses concat filter for merging several video files and should not be used for encoding video from images.

将ffmpeg图像多路分配器与ConvertMedia方法配合使用的正确方法:

Correct way of using ConvertMedia method with ffmpeg image demuxer:

var videoConv = new FFMpegConverter();
videoConv.ConvertMedia( 
   @"g:\Storage\%03d.jpg", null, 
   "test.mp4", null, 
   new ConvertSettings() {
      CustomInputArgs = " -framerate 5 ",

      // specify any additional ffmpeg parameters for output here
      CustomOutputArgs = " -profile:v high " 
});

这篇关于Nreco视频转换器从图像序列制作视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆