怎么对摄像头拍摄到的图象进行视频实时压缩?

风月无边 2005-09-21 03:25:26
怎么对摄像头拍摄到的图象进行视频实时压缩?
听说Mpeg-4压缩效果不错,不过不知道咋弄的,有谁懂了?给指点指点,分不够提出来再加也成啊!
...全文
906 15 打赏 收藏 转发到动态 举报
写回复
用AI写文章
15 条回复
切换为时间正序
请发表友善的回复…
发表回复
royalo 2010-06-11
  • 打赏
  • 举报
回复
帮你顶一下
风月无边 2005-10-02
  • 打赏
  • 举报
回复
顶一下!!!
风月无边 2005-09-30
  • 打赏
  • 举报
回复
出差了,这两天忙其他了。而且也没有见有啥好的想法。我见你说的这个在DSPACK里面有个一样的例子,但是觉的压缩算法ASF不好。希望可以提供个好的压缩算法!H264咋样啊?我不会用,谁来教教我!
S.F. 2005-09-26
  • 打赏
  • 举报
回复
是还没搞顶还是楼主出差了?需要demo 可以给我发email : mailluck at gmail.com
风月无边 2005-09-23
  • 打赏
  • 举报
回复
D9是啥东西啊?请详细说明???
james_qh 2005-09-22
  • 打赏
  • 举报
回复
还可以用D9
风月无边 2005-09-22
  • 打赏
  • 举报
回复
有没有DSPack的使用指南啊?
风月无边 2005-09-22
  • 打赏
  • 举报
回复
不知道咋用的;(
S.F. 2005-09-21
  • 打赏
  • 举报
回复
@ xzknet (MapleLeaf) :
汗,我不是大师,我今天刚好到弄这个视频通讯的程序,结果测试在公网上1秒不过3桢画面 ,寒……,不说这个了,说起来丢人。。

建议你采用DSPACK包装的DSHOW,Filter组件可以使用divx 接口压缩视频,而且操作很简单,回的第一帖即采用dspack 组件的实现。
touchboy 2005-09-21
  • 打赏
  • 举报
回复
请看MpegRecord源码,里面还可以选择压缩音频格式,视频可以选择MP4、AVI压缩格式,不过是VC的,我本来想转DELPHI,觉得没有必要浪费时间
FigoZhu 2005-09-21
  • 打赏
  • 举报
回复
S.F.又来了,期待发个Demo啊。
风月无边 2005-09-21
  • 打赏
  • 举报
回复
大师啊。。。刚发上来就有答复了,我看看先。严重感动ing.............
哦,不过我看见你里面说DivXEncoder这个东西,我想问一下,你这个程序用的什么压缩方法压缩的啊?还有啊,能用H.264压缩算法压缩么?
S.F. 2005-09-21
  • 打赏
  • 举报
回复
如果是采用VFW API 开发视频的话,可以通过指定编码器,这里是初始化divx。

function Init(InputFormat, OutputFormat: TBitmapInfo;
const Quality, KeyRate: Integer): Boolean;
begin
cv.lQ:=Quality;
cv.lKey:=KeyRate;
cv.lpbiIn^:=InputFormat;
cv.lpbiOut^:=OutputFormat;
cv.fccType:=MKFOURCC('V', 'I', 'D', 'C');
cv.fccHandler:=OutputFormat.bmiHeader.biCompression;
Result:=InternalInit;
end;

连接:
hIC:=ICOpen(cv.AsCardinal, cv.fccHandler, ICMODE_COMPRESS);
if hIC > 0 then
try
...
finally
ICClose(hIC);
end;
S.F. 2005-09-21
  • 打赏
  • 举报
回复
先装DSPack.
S.F. 2005-09-21
  • 打赏
  • 举报
回复
/////////Unit1.dfm/////////

object Form1: TForm1
Left = 198
Top = 114
Width = 331
Height = 197
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCloseQuery = FormCloseQuery
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 8
Top = 8
Width = 51
Height = 13
Caption = 'Output File'
end
object GO: TButton
Left = 8
Top = 48
Width = 75
Height = 25
Caption = 'GO'
TabOrder = 0
OnClick = GOClick
end
object Output: TEdit
Left = 8
Top = 24
Width = 289
Height = 21
TabOrder = 1
Text = 'c:\output.avi'
end
object Memo1: TMemo
Left = 0
Top = 81
Width = 323
Height = 89
Align = alBottom
Lines.Strings = (
'Memo1')
TabOrder = 2
end
object FilterGraph: TFilterGraph
AutoCreate = True
Mode = gmCapture
GraphEdit = True
LinearVolume = True
OnDSEvent = FilterGraphDSEvent
Left = 240
Top = 8
end
object DivXEncoder: TFilter
BaseFilter.data = {
8200000037D415438C5BD011BD3B00A0C911CE866E0000004000640065007600
6900630065003A0063006D003A007B0033003300440039004100370036003000
2D0039003000430038002D0031003100440030002D0042004400340033002D00
3000300041003000430039003100310043004500380036007D005C0078007600
690064000000}
FilterGraph = FilterGraph
Left = 240
Top = 40
end
object OpenDialog: TOpenDialog
Left = 272
Top = 8
end
object FileSource: TFilter
BaseFilter.data = {
C600000037D415438C5BD011BD3B00A0C911CE86B20000004000640065007600
6900630065003A00730077003A007B0030003800330038003600330046003100
2D0037003000440045002D0031003100440030002D0042004400340030002D00
3000300041003000430039003100310043004500380036007D005C007B004500
34003300360045004200420035002D0035003200340046002D00310031004300
45002D0039004600350033002D00300030003200300041004600300042004100
3700370030007D000000}
FilterGraph = FilterGraph
Left = 272
Top = 40
end
object MP3Enc: TFilter
BaseFilter.data = {
9600000037D415438C5BD011BD3B00A0C911CE86820000004000640065007600
6900630065003A0063006D003A007B0033003300440039004100370036003100
2D0039003000430038002D0031003100440030002D0042004400340033002D00
3000300041003000430039003100310043004500380036007D005C0038003500
4D0050004500470020004C0061007900650072002D0033000000}
FilterGraph = FilterGraph
Left = 208
Top = 40
end
end

////////Unit1.pas/////////////
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DSPack, DSUtil, StdCtrls, DirectShow9;

type
TForm1 = class(TForm)
FilterGraph: TFilterGraph;
DivXEncoder: TFilter;
OpenDialog: TOpenDialog;
GO: TButton;
Output: TEdit;
FileSource: TFilter;
Label1: TLabel;
Memo1: TMemo;
MP3Enc: TFilter;
procedure GOClick(Sender: TObject);
procedure FilterGraphDSEvent(sender: TComponent; Event, Param1,
Param2: Integer);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
private
{ D閏larations priv閑s }
public
{ D閏larations publiques }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.GOClick(Sender: TObject);
var Filter: IBaseFilter;
FileSink: IFileSinkFilter;
begin
FilterGraph.Active := true;
with FilterGraph as ICaptureGraphBuilder2 do
begin
SetOutputFileName(MEDIASUBTYPE_Avi, StringToOleStr(Output.Text), Filter, FileSink);
ShowFilterPropertyPage(Self.Handle, DivXEncoder as IBaseFilter, ppVFWCompConfig);
OpenDialog.Title := 'Select Video File';
if OpenDialog.Execute then
begin
with FileSource as IFileSourceFilter do Load(StringToOleStr(OpenDialog.FileName), nil);
RenderStream(nil, nil, FileSource as IBaseFilter, DivXEncoder as IBaseFilter, Filter);
RenderStream(nil, nil, FileSource as IBaseFilter, DivXEncoder as IBaseFilter, Filter);
FilterGraph.Play;
end;
end;
end;

procedure TForm1.FilterGraphDSEvent(sender: TComponent; Event, Param1,
Param2: Integer);
begin
memo1.Lines.Add(GetEventCodeDef(Event))
end;

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
FilterGraph.ClearGraph;
FilterGraph.Active := false;
end;

end.

1,183

社区成员

发帖
与我相关
我的任务
社区描述
Delphi GAME,图形处理/多媒体
社区管理员
  • GAME,图形处理/多媒体社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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