关于媒体文件的解析,大家有什么好的想法

xjfox 2009-01-15 10:56:14
需要解析一些主流的媒体文件的媒体信息,如音频的channel num,samplerate,duration等,视频的color depth,bitrate,duration等。
现在主要考虑windows平台下的,考虑过借助于dshow,但是一般的splitter应该不提供AP访问的类似接口,自己写splitter的话,还不如只实现文件解析这一部分。不知道windows自带的查看文件属性里是怎么解析的?大家有没有好建议?
...全文
173 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
xjfox 2009-01-21
  • 打赏
  • 举报
回复
过年了,先结帖,来年再来讨论

祝各位春节快乐:)
xjfox 2009-01-19
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 wwwllg 的回复:]
你系统不支持的格式有必要知道他的格式么?

比如一个doc文档 ,ffmpeg一样不知道。
[/Quote]

现在的目标就是要解析出一些特定格式的媒体信息(如mp3、aac、avi、mpg等),如果系统不支持,就得想办法让系统支持。
目前看来IMediaDet可以满足部分需求,但还不够。ffdshow可能又涉及到lisence的问题,因为我们最终要商业发布
  • 打赏
  • 举报
回复
mark
sxcong 2009-01-17
  • 打赏
  • 举报
回复
IMediaDet只能得到一部分信息,还要依赖系统安装了相应的 codec
UDX协议 2009-01-17
  • 打赏
  • 举报
回复
你系统不支持的格式有必要知道他的格式么?

比如一个doc文档 ,ffmpeg一样不知道。
xjfox 2009-01-16
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 woshizhanhun 的回复:]
用ffmpeg打开这个文件,并把这个文件的所有相关信息存入这个结构体中AVFormatContext

if(av_open_input_file(&ifmtContext,ifile,NULL,0,NULL)!=0)
{
return FALSE;
}

if(av_find_stream_info(ifmtContext) <0)
{
return FALSE;
}

然后你可以利用结构体AVFormatContext
找到任何想要的信息
[/Quote]

有空试一下先,谢谢了
xjfox 2009-01-16
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 wwwllg 的回复:]
IMediaDet Interface
The IMediaDet interface retrieves information about a media file, such as the number of streams, and the media type, duration, and frame rate of each stream. It also contains methods for retrieving individual frames from a video stream. The Media Detector (MediaDet) object exposes this interface.

To obtain information about a file using this interface, perform the follo…
[/Quote]

感谢,昨天试了试,确实能得到一些信息,但似乎并不完整。可能还是依赖于某些filter的实现,一些信息字段并没有填写有效值。
rightorwrong 2009-01-16
  • 打赏
  • 举报
回复
要么通过媒体数据里的帧信息就行解码,这样用ffmpeg中的av_find_stream_info可以实现
要么对文件格式进行分析,文件头里有这样的信息。avi的有,其它的应该也有

我觉得解析帧信息更正确些
woshizhanhun 2009-01-15
  • 打赏
  • 举报
回复
用ffmpeg打开这个文件,并把这个文件的所有相关信息存入这个结构体中AVFormatContext

if(av_open_input_file(&ifmtContext,ifile,NULL,0,NULL)!=0)
{
return FALSE;
}

if(av_find_stream_info(ifmtContext)<0)
{
return FALSE;
}

然后你可以利用结构体AVFormatContext
找到任何想要的信息
UDX协议 2009-01-15
  • 打赏
  • 举报
回复
IMediaDet Interface
The IMediaDet interface retrieves information about a media file, such as the number of streams, and the media type, duration, and frame rate of each stream. It also contains methods for retrieving individual frames from a video stream. The Media Detector (MediaDet) object exposes this interface.

To obtain information about a file using this interface, perform the following steps:

Create an instance of the MediaDet object by calling CoCreateInstance. The class ID is CLSID_MediaDet.
Call IMediaDet::put_Filename to specify the name of the source file.
Call IMediaDet::get_OutputStreams to obtain the number of output streams in the source.
Call IMediaDet::put_CurrentStream to specify a particular stream.
Call any of the following methods:

2,553

社区成员

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

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