4

My application receives a sequence of images (BitmapImage) from external device with rate 30 fps. I'm using Aforge.net library for save the received stream in .avi file. I used the following code for inizializing the AVIWriter:

AVIWriter writer;
writer = new AVIWriter("wmv3");
writer.FrameRate = 30;
writer.Open("test.avi", 320, 240);

And for each frame received I add it in the video stream, with the following code line:

writer.AddFrame(ResizeBitmap(BitmapImage2Bitmap(e.ColorFrame.BitmapImage),320,240));

But the generated file is too heavy. (10 secondos corresponds to about 3Mb).

I tryied also setting a low level of writer.Quality , but the result seems the same (just 5-7% less).

So, I need a more efficient compression.

What are the compressions supported in Aforge.net ? What compression should I use in order to reducing the weight of saved file?

4

1 回答 1

7

我怀疑 AVIWriter 中没有使用帧间压缩(但我可能错了)。您可以尝试使用来自 Aforge.Video.FFMPEG 的 VideoFileWriter:

var writer = new VideoFileWriter();
writer.Open("test.mpg", 320, 240, 30, VideoCodec.Default, 1000);
// add your frame
writer.WriteVideoFrame(frame);

请记住将 AForge zip 中的 Externals/ffmpeg/bin 中的 dll 放入您的输出目录。

于 2013-05-20T15:25:58.393 回答