我添加了作为参考avi.file 然后我使用AviManager类: 我想要做的是从我的硬盘上的一些屏幕截图文件创建avi文件。
AviManager aviManager = new AviManager(@"..\..\Output\output.avi", false);
VideoStream aviStream = null;
aviStream = aviManager.AddVideoStream(true,4, bi);
aviStream.AddFrame(b);
但是我不明白bi应该是什么,b应该是什么?
这是该类的代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using unfreez_wrapper;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
using AviFile;
namespace ScreenVideoRecorder
{
public static class AnimatedGif
{
private static UnFreezWrapper unfreez;
private static FileInfo[] fi;
private static FileInfo[] fi1;
private static DirectoryInfo di;
private static string filename;
public static void CreateAnimation()
{
unfreez = new UnFreezWrapper();
List<string> files = new List<string>();
di = new DirectoryInfo(@"D:\Testbmp");
fi = di.GetFiles("*.jpg");
for (int x = 0; x < fi.Length; x++)
{
var jpg = Image.FromFile(fi[x].FullName);
jpg.Save(@"D:\Testbmp\GifConverted\" + x.ToString("D6")+".Gif", ImageFormat.Gif);
jpg.Dispose();
}
di = new DirectoryInfo(@"D:\Testbmp\GifConverted");
fi1 = di.GetFiles("*.Gif");
for (int i = 0; i < fi.Length; i++)
{
files.Add(fi1[i].FullName);
}
string fname = "D:\\Testbmp\\animatedfile3.gif";
unfreez.MakeGIF(files, fname, 50, false);
}
public static void CreateAvi()
{
AviManager aviManager = new AviManager(@"..\..\Output\output.avi", false);
VideoStream aviStream = null;
aviStream = aviManager.AddVideoStream(true, 4, bi);
aviStream.AddFrame(b);
}
}
}
我现在添加了CreateAvi方法。
答案 0 :(得分:0)
b和bi都是位图。 bi是初始位图,b是您接下来要添加的位图。