DirectShow 记录问题 - fps [英] DirectShow Record Problem - fps
问题描述
我只是创建简单的图表来从源过滤器录制视频:
I just create simple graph to record video from a source Filter:
SourceFilter ---> Muxer ---> FileWriter
我可以将来自 SourceFilter 的视频保存到我的本地磁盘.
I can able to save video which come from SourceFilter to my local disk.
But when i try to play the recorded video, it play in "slow motion" :-).
肯定有fps(每秒帧数)问题.我该如何解决?有什么想法吗?
It is sure that there is fps (frame persecond) problem. How can i fix it? any ideas?
附注:
要检查我的 SourceFilter 是否提供正确的 fps,我只需创建另一个图表:
To check if my SourceFilter give righ fps i simply create another graph:
SourceFilter ---> Video Decoder ---> Video Renderer
它以正确的速度 (fps) 播放
and it plays at right speed (fps)
更多详情:
SourceFilter(*.mp4 file format) ---> Avi Mux Filter ---> File writer Filter
此记录但 fps 错误.
This record but in wrong fps.
当我尝试 gdcl MP4 Mux 时(可以在这里看到 )我成功获得了正确的 fps.
When I try gdcl MP4 Mux ( can see it here ) i successfully get right fps.
SourceFilter(*.mp4 file format) ---> GDCL MPEG 4 Mux Filter ---> File writer Filter
其他场景
SourceFilter( *.h264 file format) ---> Avi Mux Filter ---> File writer Filter
SourceFilter( *.h264 file format) ---> GDCL MPEG 4 Mux Filter---> File writer Filter
录了但是录了文件不播放.
实际上我不想解码任何东西......只需将原始编码的视频帧(mp4,h264)写入文件.而且我可能不需要视频同步音频......为什么需要多路复用器?
And actually i do not want decode anything...Just write the originally encoded video frames(mp4,h264) into file. And also i may not need syn audio with video...Why need Mux?
我理想的过滤器应该是这样的:
My ideal filter should be like this:
SourceFilter(whatever format) ---> File writer
推荐答案
Ralf 的评论可能是对的.AVI 文件格式没有每帧时间戳,只有平均帧速率.因此,当一个帧到达时,复用器必须决定是将该帧放置在下一个槽"中,还是插入一个丢帧"标记并将该帧放入之后的槽中.如果源过滤器的时间戳与媒体类型的帧速率不匹配,那么您将获得此效果.
Ralf's comment is probably right. The AVI file format doesn't have per-frame timestamps, just an average frame rate. So when a frame arrives, the mux has to decide whether to place this frame in the next "slot", or insert a "dropped frame" marker and put the frame in the slot after. If the source filter's timestamps don't match the media type's frame rate, then you will get this effect.
您可以将视频基本流保存到文件中,但使用转储过滤器示例,而不是文件编写器.文件编写器有一个特殊的协议来允许多路复用器随机访问文件(使用时间戳作为文件偏移量).您只想将数据保存为流,而 Dump 示例就是这样做的.
You can save your video elementary stream to a file, but use the Dump filter example, not the file writer. The file writer has a special protocol to allow multiplexors random access to the file (using the timestamps as file offsets). You want to just save the data as a stream, and the Dump example does that.
这篇关于DirectShow 记录问题 - fps的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!