请问如何网上直播从摄像头上得到的视频,400分!!(100分)

  • 主题发起人 主题发起人 catman
  • 开始时间 开始时间
谢谢
偶急需一份
kaiserbai@163.com
 
能否也发给我一份.
xzmyzy1@163.com.
谢谢!
 
可以的话也给我一份吧!谢谢!
lip7741@163.com
 
简单的视频捕获程序,提供参考
unit Unit1;
  
   interface
  
   uses
   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
   Dialogs, StdCtrls, Buttons, ExtCtrls, MPlayer;
  
   type
   TForm1 = class(TForm)
   MediaPlayer1: TMediaPlayer;
   Panel1: TPanel;
   BitBtn1: TBitBtn;
   OpenDialog1: TOpenDialog;
   Button1: TButton;
   Button2: TButton;
   Button3: TButton;
   Button4: TButton;
   Button5: TButton;
   Button6: TButton;
   SaveDialog2: TSaveDialog;
   procedure BitBtn1Click(Sender: TObject);
   procedure FormCreate(Sender: TObject);
   procedure Button1Click(Sender: TObject);
   procedure Button2Click(Sender: TObject);
   procedure Button4Click(Sender: TObject);
   procedure Button3Click(Sender: TObject);
   procedure Button5Click(Sender: TObject);
   procedure Button6Click(Sender: TObject);
   private
   hWndC : THandle;
//视频捕获句柄声明
   CapturingAVI: bool;
//开始视频录制
   { Private declarations }
   public
   { Public declarations }
   end;

  
   var
   Form1: TForm1;
  
   implementation
  
   {$R *.dfm}
   //视频捕获常量声明
   const WM_CAP_START = WM_USER;
   const WM_CAP_STOP = WM_CAP_START + 68;
   const WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10;
   const WM_CAP_DRIVER_DISCONNECT = WM_CAP_START +11;
   const WM_CAP_SAVEDIB = WM_CAP_START + 25;
   const WM_CAP_GRAB_FRAME = WM_CAP_START + 60;
   const WM_CAP_SEQUENCE = WM_CAP_START +62;
   const WM_CAP_FILE_SET_CAPTURE_FILEA = WM_CAP_START + 20;
   //捕获视频主函数
   function capCreateCaptureWindowA(
   lpszWindowName: pchar;
   dwStyle: longint;
   x: integer;
   y: integer;
   nWidth: integer;
   nHeight: integer;
   ParentWin: HWND;
   nId: integer): HWND;
   STDCALL EXTERNAL 'AVICAP32.DLL';
   {AVICAP.DLL:包含执行视频捕获的函数,它给AVI文件的I/O处理和视频、音频设备驱动程序提供一个高级接口;}
  
  
   procedure TForm1.BitBtn1Click(Sender: TObject);
   begin

   if OpenDialog1.Execute then

   begin

   MediaPlayer1.Close;
   MediaPlayer1.FileName:=OpenDialog1.FileName;
   Try
   MediaPlayer1.Open;
   Except
   ShowMessage(MediaPlayer1.ErrorMessage);
   end;

   if MediaPlayer1.Error=0 then

   begin

   MediaPlayer1.TimeFormat:=tfSMPTE25;
   //StatusBar1.Panels[1].Text:=MediaPlayer1.FileName;
   MediaPlayer1.Play;
   end;

   end;

   end;

  
   procedure TForm1.FormCreate(Sender: TObject);
   begin

   {***视频捕获初始化***}
   CapturingAVI:=false;
   hWndC:=0;
   SaveDialog2.Options :=[ofHideReadOnly, ofNoChangeDir, ofPathMustExist];
   end;

  
   procedure TForm1.Button1Click(Sender: TObject);
   begin

   { 初始化捕获视频主函数 }
   hWndC:= capCreateCaptureWindowA(
   'cpature window',
   WS_CHILD or WS_VISIBLE,
   panel1.Left,
   panel1.Top,
   panel1.Width,
   panel1.Height,
   panel1.Handle,
   0);
   if hWndC <> 0 then

   sendMessage(hWndC, WM_CAP_DRIVER_CONNECT, 0, 0);
//发送启动消息
   end;

  
   procedure TForm1.Button2Click(Sender: TObject);
   begin

   if hWndC <> 0 then

   begin

   sendMessage(hWndC, WM_CAP_DRIVER_DISCONNECT, 0, 0);
   hWndC:= 0;
   end;

   end;

  
   procedure TForm1.Button4Click(Sender: TObject);
   begin

   if hWndC <> 0 then

   sendMessage(hWndC, WM_CAP_GRAB_FRAME, 0, 0);
   end;

  
   procedure TForm1.Button3Click(Sender: TObject);
   begin

   if hWndC <> 0 then

   begin

   SaveDialog2.DefaultExt := 'bmp';
   SaveDialog2.Filter :='Bitmap files (*.bmp)|*.bmp';
   if SaveDialog2.Execute then

   SendMessage(hWndC, WM_CAP_SAVEDIB, 0, longint(pchar(SaveDialog2.FileName)));
   end;

   end;

  
   procedure TForm1.Button5Click(Sender: TObject);
   begin

   if hWndC <>0 then

   begin

   SaveDialog2.DefaultExt :='*.avi';
   SaveDialog2.Filter :='AVI Files (*.avi)|*.avi';
   if SaveDialog2.Execute then

   begin

   CapturingAVI := true;
   sendMessage(hWndC, WM_CAP_FILE_SET_CAPTURE_FILEA, 0, Longint(pchar(SaveDialog2.FileName)));
   sendMessage(hWndC, WM_CAP_SEQUENCE, 0, 0);
   end;

   end;

   end;

  
   procedure TForm1.Button6Click(Sender: TObject);
   begin

   if hWndC <> 0 then

   begin

   sendMessage(hWndC, WM_CAP_STOP, 0, 0);
   CapturingAVI:=false;
   end;

   end;

  
   end.

  
 
偶也想要一份,大虾帮帮忙吧
kaiserbai@163.com
谢谢
 
我也想要一份,如果可以的话!十分感谢!!
wenchengxtu@163.com
 

Similar threads

D
回复
0
查看
911
DelphiTeacher的专栏
D
D
回复
0
查看
868
DelphiTeacher的专栏
D
D
回复
0
查看
840
DelphiTeacher的专栏
D
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
后退
顶部