110,534
社区成员
发帖
与我相关
我的任务
分享
/// <summary>
/// 创建新帧
/// </summary>
/// <param name="nextframe">帧</param>
public void AddFrame(Bitmap nextframe)
{
Bitmap _bmp = new Bitmap(nextframe);
BitmapData bmpDat = _bmp.LockBits(
new Rectangle(0, 0, (int)_width, (int)_height),
ImageLockMode.ReadOnly, PixelFormat.Format32bppRgb);
int hr = AVIStreamWrite(_psCompressed, _count, 1,
bmpDat.Scan0,
(Int32)(_width * _height * 4),
0,
0,
0);
if (hr != 0)
{
throw new AviException("无法把视频流写入到视频文件中");
}
_bmp.UnlockBits(bmpDat);
_bmp.Dispose();
_bmp = null;
_count++;
}