将视频流保存为asf文件,但是请问设置asf文件视频图像的宽度和高度的接口指针是什么??

aoosang 2005-01-31 10:15:40
如题
...全文
706 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
aoosang 2005-02-02
  • 打赏
  • 举报
回复
希望对后面遇到同样问题的兄弟们有个帮助,下面我要结贴了,再次感谢陆,蒋两位老大
aoosang 2005-02-02
  • 打赏
  • 举报
回复
ok,问题已经解决,谢谢蒋兄和 陆兄的指点 ,解决的方法,我找到了系统的profile,并且手动修改了系统的profile, Directshow自己带的profile放在WINNT目录下,名字叫WMSysPr9.prx.dshow所用到的profile 都在这个文件里,采用的XML格式,下面我给出一个profile的格式

摘录了一个profile ,

<profile version="458752"
name="Video for dial-up modems or LAN (28.8 to 100 Kbps)"
guid="{07DF7A25-3FE2-4A5B-8B1E-348B0721CA70}"
description="Use this multiple bit rate profile for target audiences with a dial-up modem, LAN, or dual-channel ISDN connection (bandwidths between 28.8 to 100 Kbps).">
<streamconfig majortype="{73647561-0000-0010-8000-00AA00389B71}"
streamnumber="1"
streamname="Audio Stream"
inputname="Audio"
bitrate="8000"
bufferwindow="-1">
<wmmediatype subtype="{00000161-0000-0010-8000-00AA00389B71}"
bfixedsizesamples="1"
btemporalcompression="0"
lsamplesize="64">
<waveformatex wFormatTag="353"
nChannels="1"
nSamplesPerSec="8000"
nAvgBytesPerSec="1000"
nBlockAlign="64"
wBitsPerSample="16"
codecdata="00220000000000000000"/>
</wmmediatype>
</streamconfig>
<streamconfig majortype="{73646976-0000-0010-8000-00AA00389B71}"
streamnumber="2"
streamname="Video Stream"
inputname="Video"
bitrate="7062"
bufferwindow="-1">
<videomediaprops maxkeyframespacing="80000000"
quality="0"/>
<wmmediatype subtype="{31564D57-0000-0010-8000-00AA00389B71}"
bfixedsizesamples="0"
btemporalcompression="1"
lsamplesize="0">
<videoinfoheader dwbitrate="7062"
dwbiterrorrate="0"
avgtimeperframe="666666">
<rcsource left="0"
top="0"
right="176"
bottom="144"/>
<rctarget left="0"
top="0"
right="176"
bottom="144"/>
<bitmapinfoheader biwidth="176"
biheight="144"
biplanes="1"
bibitcount="24"
bicompression="WMV1"
bisizeimage="0"
bixpelspermeter="0"
biypelspermeter="0"
biclrused="0"
biclrimportant="0"/>
</videoinfoheader>
</wmmediatype>
</streamconfig>
<streamconfig majortype="{73646976-0000-0010-8000-00AA00389B71}"
streamnumber="3"
streamname="Video Stream"
inputname="Video"
bitrate="11338"
bufferwindow="-1">
<videomediaprops maxkeyframespacing="80000000"
quality="0"/>
<wmmediatype subtype="{31564D57-0000-0010-8000-00AA00389B71}"
bfixedsizesamples="0"
btemporalcompression="1"
lsamplesize="0">
<videoinfoheader dwbitrate="11338"
dwbiterrorrate="0"
avgtimeperframe="666666">
<rcsource left="0"
top="0"
right="176"
bottom="144"/>
<rctarget left="0"
top="0"
right="176"
bottom="144"/>
<bitmapinfoheader biwidth="176"
biheight="144"
biplanes="1"
bibitcount="24"
bicompression="WMV1"
bisizeimage="0"
bixpelspermeter="0"
biypelspermeter="0"
biclrused="0"
biclrimportant="0"/>
</videoinfoheader>
</wmmediatype>
</streamconfig>
<streamconfig majortype="{73646976-0000-0010-8000-00AA00389B71}"
streamnumber="4"
streamname="Video Stream"
inputname="Video"
bitrate="23970"
bufferwindow="-1">
<videomediaprops maxkeyframespacing="80000000"
quality="0"/>
<wmmediatype subtype="{31564D57-0000-0010-8000-00AA00389B71}"
bfixedsizesamples="0"
btemporalcompression="1"
lsamplesize="0">
<videoinfoheader dwbitrate="23970"
dwbiterrorrate="0"
avgtimeperframe="666666">
<rcsource left="0"
top="0"
right="176"
bottom="144"/>
<rctarget left="0"
top="0"
right="176"
bottom="144"/>
<bitmapinfoheader biwidth="176"
biheight="144"
biplanes="1"
bibitcount="24"
bicompression="WMV1"
bisizeimage="0"
bixpelspermeter="0"
biypelspermeter="0"
biclrused="0"
biclrimportant="0"/>
</videoinfoheader>
</wmmediatype>
</streamconfig>
<streamconfig majortype="{73646976-0000-0010-8000-00AA00389B71}"
streamnumber="5"
streamname="Video Stream"
inputname="Video"
bitrate="87127"
bufferwindow="-1">
<videomediaprops maxkeyframespacing="80000000"
quality="0"/>
<wmmediatype subtype="{31564D57-0000-0010-8000-00AA00389B71}"
bfixedsizesamples="0"
btemporalcompression="1"
lsamplesize="0">
<videoinfoheader dwbitrate="87127"
dwbiterrorrate="0"
avgtimeperframe="666666">
<rcsource left="0"
top="0"
right="176"
bottom="144"/>
<rctarget left="0"
top="0"
right="176"
bottom="144"/>
<bitmapinfoheader biwidth="176"
biheight="144"
biplanes="1"
bibitcount="24"
bicompression="WMV1"
bisizeimage="0"
bixpelspermeter="0"
biypelspermeter="0"
biclrused="0"
biclrimportant="0"/>
</videoinfoheader>
</wmmediatype>
</streamconfig>
<mutualexclusion type="{D6E22A01-35DA-11D1-9034-00A0C90349BE}">
<stream number="2"/>
<stream number="3"/>
<stream number="4"/>
<stream number="5"/>
</mutualexclusion>
</profile>
蒋晟 2005-02-02
  • 打赏
  • 举报
回复
不要用系统的profile,自己建一个profile
aoosang 2005-02-01
  • 打赏
  • 举报
回复
还有diectshow自带的profile都放在那个文件夹下? 我想看看是否修改成功,

另: 我已经试过了,效果不明显,我怀疑是否真正修改了profile,所以想查看一下
happydeer 2005-02-01
  • 打赏
  • 举报
回复
wm asf writer默认使用的是v8的系统Profile,他的视频大小都是 320 x 240这么大小的。可以通过IConfigAsfWriter::GetCurrentProfile获得Profile对象,然后按你的要求修改,正如你描述的那样。(你为什么不按你的想法试一下,如果碰到问题再把问题贴出来。)

另外一个办法,就是使用windows media format sdk自己来创建一个profile,然后通过wm asf writer的IConfigAsfWriter::ConfigureFilterUsingProfile设置,这种方式可以使用最新的9系列的编解码器(系统Profile只能使用v8的编解码器)。

profile的创建可以参考wmf sdk 9的例子:wmgenprofile。
aoosang 2005-02-01
  • 打赏
  • 举报
回复

谢谢蒋老大,下面我详细描述一下我的问题,

我用dshow带的一个filter (pushsource)来捕捉全屏幕,然后写入asf文件,遇到的问题是asf文件回放的时候,画面大小为320*240,如果拖动放大全屏播放,失真太厉害.后来我将pushSource Filter的拷贝屏幕的区域限定为320*240,asf文件播放正常.我才知道可能是写入asf文件时限定了图像的大小,所以我现在想通过修改profile来修改asf文件的视频大小(高度和宽度),我不知道我是否可以通过修改系统配置的profile达到目的?还是我必须自己要重新生成自己的profile? 还有diectshow自带的profile都放在那个文件夹下?
我用下面的代码修改asf 文件的图像的高度和宽度是否可行?
VIDEOINFOHEADER *pVih = reinterpret_cast<VIDEOINFOHEADER*>mediaType.pbFormat);
// 在这里重新设置视频流的属性
pVih->bmiHeader.biWidth=1024;
pVih->bmiHeader.biHeight=768;
蒋晟 2005-02-01
  • 打赏
  • 举报
回复
改了长宽之后WM_MEDIA_TYPE的lSampleSize;WMVIDEOINFOHEADER的rcSource,rcTarget,dwBitRate和bmiHeader应该都要改
aoosang 2005-02-01
  • 打赏
  • 举报
回复
IWMProfile *ppProfile;
pAsfConfig->GetCurrentProfile (&ppProfile);

IWMStreamConfig* ppConfig;
ppProfile->GetStream(0,&ppConfig); //获取视频流的
/////设置视频流的属性
IWMMediaProps *pMediaProps;
ppConfig->QueryInterface(IID_IWMMediaProps,(void**)(&pMediaProps));
WM_MEDIA_TYPE mediaType;
DWORD bufsize;
pMediaProps->GetMediaType(NULL,&bufsize);
pMediaProps->GetMediaType(&mediaType,&bufsize);

VIDEOINFOHEADER *pVih = reinterpret_cast<VIDEOINFOHEADER*>(mediaType.pbFormat);

// 在这里重新设置视频流的属性
pVih->bmiHeader.biWidth=1024;
pVih->bmiHeader.biHeight=768;
pMediaProps->SetMediaType(&mediaType);


陆兄看看上面设置图像的大小的一段代码是否正确?
pVih->bmiHeader.biWidth=1024;
pVih->bmiHeader.biHeight=768;
RunningYang 2005-02-01
  • 打赏
  • 举报
回复
顶一下
happydeer 2005-01-31
  • 打赏
  • 举报
回复
视频的格式细节是由媒体类型来描述的。你可以从IWMStreamConfig接口查询获得IWMMediaProps接口,然后调用GetMediaType、SetMediaType去调整视频的宽度和高度。
aoosang 2005-01-31
  • 打赏
  • 举报
回复
希望朋友们帮忙
aoosang 2005-01-31
  • 打赏
  • 举报
回复
下面是IWMStreamConfig接口的所有函数,我只看到如何调整bitrate,但是那个函数使用调整视频流的图像的高度和宽度啊,老大,继续指示
Method Description
GetBitrate Retrieves the bit rate for the stream.
GetBufferWindow Retrieves the maximum latency between when a stream is received and when it begins to be displayed.

GetConnectionName Retrieves the connection name given to the stream.
GetStreamName Retrieves the stream name.
GetStreamNumber Retrieves the stream number.
GetStreamType Retrieves the major type of the stream (audio, video, or script).
SetBitrate Specifies the bit rate for the stream.
SetBufferWindow Specifies the maximum latency between when a stream is received and when it begins to be displayed.

SetConnectionName Specifies the connection name given to a stream.
SetStreamName Specifies the stream name.
SetStreamNumber Specifies the stream number.
happydeer 2005-01-31
  • 打赏
  • 举报
回复
要通过Profile去设置。

Profile对象的接口IProfile,它内部的流配置子对象IWMStreamConfig。
aoosang 2005-01-31
  • 打赏
  • 举报
回复
楼上的你问我还是问陆老大啊?我还是一个裤衩呢
yyhzpk 2005-01-31
  • 打赏
  • 举报
回复
弱弱问一下:
asf 的网上播放和定位速度
好像很慢,有很大的延迟,我现在还不明白为什么要用
这些格式,它有那些好处,
aoosang 2005-01-31
  • 打赏
  • 举报
回复
ok,谢谢陆兄的指点,我也是这么做的,见代码,其中pAsfConfig是从asfwriter指针获取的.
IWMProfile *ppProfile;
pAsfConfig->GetCurrentProfile (&ppProfile);

IWMStreamConfig* ppConfig;
ppProfile->GetStream(0,&ppConfig); //获取视频流的
/////设置视频流的属性
IWMMediaProps *pMediaProps;
ppConfig->QueryInterface(IID_IWMMediaProps,(void**)(&pMediaProps));
WM_MEDIA_TYPE mediaType;
DWORD bufsize;
pMediaProps->GetMediaType(NULL,&bufsize);
pMediaProps->GetMediaType(&mediaType,&bufsize);
////////////////////////
VIDEOINFOHEADER *pVih = reinterpret_cast<VIDEOINFOHEADER*>(mediaType.pbFormat);
在这里重新设置视频流的属性
.........
//////////////////////////
pMediaProps->SetMediaType(&mediaType);


我想通过pVih指针设置视频的大小,VIDEOINFOHEADER结构如下:

typedef struct tagVIDEOINFOHEADER {
RECT rcSource,
RECT rcTarget;
DWORD dwBitRate;
DWORD dwBitErrorRate;
REFERENCE_TIME AvgTimePerFrame;
BITMAPINFOHEADER bmiHeader;
} VIDEOINFOHEADER;

因为我看到BITMAPINFOHEADER 结构有两个成员
LONG biWidth;
LONG biHeight;
不知道是否通过这bmiHeader的两个变量来设置视频的宽度和高度,???
另:我通过查看GetMediaType返回的媒体类型,发现biWidth和 biHeight都是零?怎么解释啊?
还请陆兄再次指教



附:BITMAPINFOHEADER结构
typedef struct tagBITMAPINFOHEADER {
DWORD biSize;
LONG biWidth;
LONG biHeight;
WORD biPlanes;
WORD biBitCount;
DWORD biCompression;
DWORD biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
} BITMAPINFOHEADER;
qrlvls 2005-01-31
  • 打赏
  • 举报
回复
源码链接: https://pan.quark.cn/s/0f7c75cb3aad ### MIPI Video Mode 与 Command Mode 的差异 #### 一、引言 MIPI (Mobile Industry Processor Interface) 是一种用于连接移动设备中处理器及其外围设备的标准化接口。MIPI 接口支持多种协议,其中包含 DSI (Display Serial Interface) 和 DCS (Display Control Interface) 等协议。在 MIPI 接口的应用中,主要涉及两种工作模式:Video Mode(视频模式)和 Command Mode(命令模式)。本文旨在系统性地阐述这两种模式的工作机制、特性以及实际应用环境。 #### 二、LCD RAM 概念说明 在进一步探讨 MIPI 的两种模式之前,有必要对文中提及的“LCD RAM”概念进行明确。实际上,“LCD RAM”并非一个通用术语,而是本文作者用来描述 LCD 控制器中用于存储显示数据的内存区域。LCD(Liquid Crystal Display,液晶显示屏)通常配备一个控制 IC(Integrated Circuit,集成电路),该控制 IC 可能内置 RAM 以缓存显示数据。 #### 三、MIPI Video Mode(视频模式) **定义:** - 视频模式是一种类似于传统 RGB 接口的工作模式,它要求主机持续不断地向显示器传输刷新数据。 - 在这种模式下,数据和控制信号以报文的形式通过 MIPI 总线进行传输。 - 显示器本身无需配备帧缓冲器,因为主机会周期性地刷新屏幕。 **特点:** 1. **实时性高:** 主机需要不...
源码下载地址: https://pan.quark.cn/s/a4b39357ea24 在电磁模拟技术中,CST(Computer Simulation Technology)是一种被广泛采纳的软件工具,它主要用于电磁场、微波、天线以及射频系统的设计工作。本资料将详细分析CST软件中离散端口的具体配置方法,这些方法对于提升仿真结果的精确度和专业水准具有决定性作用。离散端口在CST软件中扮演着模拟信号输入或输出的重要角色,它们构成了仿真模型不可或缺的部分。在配置离散端口时,一个核心的原则是保证端口的方向与网格线保持一致,这是因为这样做能够有效降低计算过程中产生的误差,并确保仿真数据的有效性。如果未能遵循这一指导原则,可能会引发未知的计算问题,进而导致仿真结果失去可靠性。 在CST软件中配置离散端口,通常需要借助“Pick Points”这一功能。通过选择“Pick Edge Center”选项,端口将被设定在模型边缘的中心位置上。然而,这种做法并不总是能够确保端口与网格线保持平行。在某些特定情形下,模型的几何构造可能不允许直接选取一个与网格线平行的边作为端口的安装位置。 为了克服这一挑战,可以采用多种不同的策略。如果模型本身已经包含一条与馈电口平行的边,那么可以直接利用这条边来建立端口,此时CST软件会自动调整端口使其与网格线对齐。另一种可选的方法是,当模型不具备现成的平行边时,用户可以手动构建一个几何结构,比如一个立方体,并使其边缘与馈电口平行。通过这种方式,新建立的几何结构的边缘就可以作为端口的位置,从而确保端口与网格线的平行关系。 在实施上述操作时,必须关注端口尺寸的合理性和物理意义的一致性。端口的尺寸应当依据实际天线馈电部分的尺寸进行适当调整,过大的端口或...

2,554

社区成员

发帖
与我相关
我的任务
社区描述
专题开发/技术/项目 多媒体/流媒体开发
社区管理员
  • 多媒体/流媒体开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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