directshow采集avi存储的文件名问题

Carmack Jiang 2008-10-31 09:10:25
我的filter graph:src filter->samplegrabber->ms mpeg-4->avi mux->file writer
如果在mediacontrol::run()后又没有办法可以修改存储的文件名?我尝试过的办法:先stop掉链路,再修改存储文件名,再run(),倒是可行,就是延迟达到300ms,也就是有300ms的视频没有录制。由于视频要和其他做影射,有没有办法一点延迟点没有?
...全文
122 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
Carmack Jiang 2008-11-03
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 wwwllg 的回复:]
你需要两个graphs, one include (you cap source + your export interface).
the second include (bridge source <create the access interface of first graph>+ avi mux + writer)

the first graph never stop.(it need more time when you stop it ,so you do not call stop)

and the second graph ,you can stop it and create new writer if you need.it need less time.
[/Quote]
让我疑惑的是
就算做两个接口COM
然后注册成过滤器
这两个过滤器总要相连吧
如何做到两个graph相互独立
Carmack Jiang 2008-11-03
  • 打赏
  • 举报
回复
然后怎么把他们注册成过滤器拿来使用
Carmack Jiang 2008-11-03
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 wwwllg 的回复:]
我给你说的就是最优方案。我已经实现了。
[/Quote]
请高手提示个思路
export interface和bridge source 是不是两个COM接口?
Carmack Jiang 2008-10-31
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 wwwllg 的回复:]
你需要两个graphs, one include (you cap source + your export interface).
the second include (bridge source <create the access interface of first graph>+ avi mux + writer)

the first graph never stop.(it need more time when you stop it ,so you do not call stop)

and the second graph ,you can stop it and create new writer if you need.it need less time.
[/Quote]
可能我要先尝试一下无延迟的缓存方案,再尝试延迟较小的方案
Thank you all the same~
UDX协议 2008-10-31
  • 打赏
  • 举报
回复
你需要两个graphs, one include (you cap source + your export interface).
the second include (bridge source <create the access interface of first graph>+ avi mux + writer)

the first graph never stop.(it need more time when you stop it ,so you do not call stop)

and the second graph ,you can stop it and create new writer if you need.it need less time.
Carmack Jiang 2008-10-31
  • 打赏
  • 举报
回复
如果有缓存机制,除了创建另一个内存文件的时间,几乎没有延迟
Carmack Jiang 2008-10-31
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 anakiagmail 的回复:]
修改文件名,其实是想生成一个新的文件,在这条链路中,影响avi文件生成的filter有2个,一个最直接的是file writer,另一个是avi mux, 微软的file writer在run的过程中,应该是不能修改文件名的,所以如果想修改必须重写file writer,但是是否重写file writer就可以了?写文件是可以了,但是写出来的avi文件可能就播放不了了,所以也应该重写avi mux,当修改文件名时,让avi mux自己再生成avi 文件头。恩,从这样来说,一个简单的…
[/Quote]
avi mux和file writer在setoutputfilename()他们就连结在一起,所以很难只修改其中一个
只要用这个链路写文件必然会有延迟 ,只是大小问题,如果在不停止链路能换文件名,延迟必然大减(因为停止和启动链路时间远远大于文件创建时间),但是确很难办到不停止链路就用file writer接口指针修改文件名。
我在考虑另一种方案,利用内存映射机制缓存视频数据,但还是有个关键问题,怎么控制视频数据流写入内存,请各位高手来讨论讨论。
咋了啦 2008-10-31
  • 打赏
  • 举报
回复
顶楼上的,将文件名作为参数传进去
anakiagmail 2008-10-31
  • 打赏
  • 举报
回复
修改文件名,其实是想生成一个新的文件,在这条链路中,影响avi文件生成的filter有2个,一个最直接的是file writer,另一个是avi mux, 微软的file writer在run的过程中,应该是不能修改文件名的,所以如果想修改必须重写file writer,但是是否重写file writer就可以了?写文件是可以了,但是写出来的avi文件可能就播放不了了,所以也应该重写avi mux,当修改文件名时,让avi mux自己再生成avi 文件头。恩,从这样来说,一个简单的办法,就是只修改file writer,记住avi 的文件头信息,当修改文件名时,file wrtier负责写入文件头。
UDX协议 2008-10-31
  • 打赏
  • 举报
回复
我给你说的就是最优方案。我已经实现了。

2,542

社区成员

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

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