求avi转bmp和bmp转avi的控件,非常着急,在线等待

dxpiaoyi 2004-11-12 02:34:42
求avi转bmp和bmp转avi的控件,非常着急,在线等待
...全文
259 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
pengxuan 2004-11-25
  • 打赏
  • 举报
回复
楼主,Jpg转AVI的例子已发,收到请回复
Hovers 2004-11-25
  • 打赏
  • 举报
回复
帮忙顶
QQgenie 2004-11-17
  • 打赏
  • 举报
回复
能否用AVICAP32.DLL

SendMessage(hWndC,WM_CAP_SAVEDIB,0,longint(pchar('c:\test.bmp')));//摄像头照像
dxpiaoyi 2004-11-13
  • 打赏
  • 举报
回复
To pengxuan(追梦人),当然要了,谢了 dxpiaoyi@163.com
pengxuan 2004-11-12
  • 打赏
  • 举报
回复
我这里有一个Jpg转AVI的例子,不知道楼主需不需 要
ksaiy 2004-11-12
  • 打赏
  • 举报
回复
还有BMP转换为AVI你可以使用AVIWriter组件,这个组件有一个bitmaps属性是一个Tlist指向一组Tbitmap对象的指针,通过write方法实现输出成Avi了。

你自己下载下来使用.

下面是一段代码,你参考一下:

procedure TForm1.Button1Click(Sender: TObject);
var
bmps : array of TfileStream;
bmp: TBitMap;
i: Integer;
begin
setlength(bmps, 5);
for i := 0 to 4 do
begin
bmp := TBitMap.Create;
bmps[i] := TFileStream.Create('e:\bmp\00' + IntToStr(i) + '.bmp', fmOpenRead);
end;
bmp.LoadFromStream(bmps[0]);
Image1.Picture.Bitmap := bmp;
bmp.LoadFromStream(bmps[1]);
Image2.Picture.Bitmap := bmp;
end;
ksaiy 2004-11-12
  • 打赏
  • 举报
回复
其实最重要的是你要分析AVI格式,这样就好做多了,下面给你一段读取AVI每一帧图片的代码,你参考一下:


uses windows, graphics;

interface

const
streamtypeAUDIO : longint = $73647561;
streamtypeVIDEO : longint = $73646976;

type
TAVIStream = record
fccType : longint;
fccHandler : longint;
dwFlags : longint;
dwCaps : longint;
wPriority : word;
wLanguage : word;
dwScale : longint;
dwRate : longint;
dwStart : longint;
dwLength : longint;
dwInitialFrames : longint;
dwSuggestedBufferSize : longint;
dwQuality : longint;
dwSampleSize : longint;
rcFrame : TRect;
dwEditCount : longint;
dwFormatChangeCount : longint;
Name : array [0..64] of char;
end;

PAVIStream = ^TAVIStream;

PAVIFile = pointer;

TAVIFileInfo = record
dwMaxBytesPerSec : longint;
dwFlags : longint;
dwCaps : longint;
dwStreams : longint;
dwSuggestedBufferSize : longint;

dwWidth : longint;
dwHeight : longint;

dwScale : longint;
dwRate : longint;
dwLength : longint;

dwEditCount : longint;

szFileType : array[0..63] of char;
end;

PAVIFileInfo = ^TAVIFileInfo;

TAVIStreamInfo = record
fccType : longint;
fccHandler : longint;
dwFlags : longint;
dwCaps : longint;
wPriority : word;
wLanguage : word;
dwScale : longint;
dwRate : longint;
dwStart : longint;
dwLength : longint;
dwInitialFrames : longint;
dwSuggestedBufferSize : longint;
dwQuality : longint;
dwSampleSize : longint;
rcFrame : TRect;
dwEditCount : longint;
dwFormatChangeCount : longint;
szName : array[0..63] of char;
end;

PAVIStreamInfo = ^TAVIStreamInfo;

function AVIFileOpen(avifile : pointer; filename : pchar; mode : integer;
CLSID : pointer) : integer; stdcall; external 'avifil32.dll' index 16;

function AVIFileRelease(avifile : pointer) : longint; stdcall; external 'avifil32.dll' index 20;

function AVIFileGetStream(avifile : pointer; avistream : PAVIStream;
streamtype : longint; lParam : longint) : integer; stdcall; external 'avifil32.dll' index 11;

function AVIStreamGetFrameOpen(avistream : PAVIStream; bitmapwanted : pointer) : pointer; stdcall; external 'avifil32.dll' index 42;

procedure AVIStreamGetFrameClose(pget : pointer); stdcall; external 'avifil32.dll' index 41;

function AVIStreamGetFrame(getframe : pointer; position : longint) : pointer; stdcall; external 'avifil32.dll' index 40;

procedure AVIStreamRelease(avistream : PAVIStream); stdcall; external 'avifil32.dll' index 53;

function AVIStreamInfo(pstream : PAVIStream; psi : PAVISTREAMINFO; lsize : longint) : integer; stdcall; external 'avifil32.dll' index 44;

function GetAviFrame(AviFilename : String; Index: Integer; var bmp: TBitmap): boolean;

implementation

function GetAviFrame(AviFilename : String; Index: Integer; var bmp: TBitmap): boolean;
var
FAviFile : Pointer;
FVideoStream : Pointer;
FGetFrame : Pointer;
info : TAVIStreamInfo;
FFrameWidth, FFrameHeight : Integer;
FStartFrame, FStopFrame : Integer;
// image : PBitmapInfoHeader;

image : pointer;
imagestart : Integer;
begin
result := false;
if (AVIFileOpen(@favifile, pchar(AviFileName), 0, nil) <> 0) then
exit;

if (AVIFileGetStream(favifile, @fvideostream, streamtypeVIDEO, 0) <> 0) then
begin
AVIFileRelease(favifile);
exit;
end;

AVIStreamInfo(fvideostream, @info, sizeof(info));
with info do
begin
fFrameWidth := rcframe.right - rcframe.left;
fFrameHeight := rcframe.bottom - rcframe.top;
fStartFrame := dwStart;
fStopFrame := dwLength - 1;
end;

if (index <fstartframe) or (index > fstopframe) then
begin
AVIStreamRelease(fvideostream);
AVIFileRelease(favifile);
exit;
end;

fgetframe := AVIStreamGetFrameOpen(fvideostream, nil);
if (fgetframe = nil) then
begin
AVIStreamRelease(fvideostream);
AVIFileRelease(favifile);
exit;
end;

// image := AVIStreamGetFrame(fgetframe, Index);

image := AVIStreamGetFrame(fGetFrame, Index);


if assigned(image) then
begin
if not assigned(bmp) then
begin
bmp := tbitmap.create;
bmp.width := fframewidth;
bmp.height := fframeheight;
end
else if bmp.empty then
begin
bmp.width := fframewidth;
bmp.height := fframeheight;
end;
// imagestart := image^.biSize + image^.biClrUsed * 4;

imagestart := TBitmapInfoHeader(image^).biSize +
TBitmapInfoHeader(image^).biClrUsed * 4;

StretchDIBits(bmp.canvas.handle, 0, 0, bmp.width, bmp.height,
0, 0, fframewidth, fframeheight,
pchar(image) + imagestart,
TBitmapInfo(image^), 0, SRCCOPY);
result := true;
end;

AVIStreamGetFrameClose(fgetframe);
AVIStreamRelease(fvideostream);
AVIFileRelease(favifile);
end;

end.
dxpiaoyi 2004-11-12
  • 打赏
  • 举报
回复
好像只有一段写AVI的
jinjazz 2004-11-12
  • 打赏
  • 举报
回复
上gool搜索
dxpiaoyi 2004-11-12
  • 打赏
  • 举报
回复
超级猛料??是什么啊?麻烦指点
jinjazz 2004-11-12
  • 打赏
  • 举报
回复
超级猛料上有,太长了,我就不贴了

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧