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?
PS:
要检查我的SourceFilter是否提供fps 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)写入文件中即可。不需要带视频的合成音频...为什么需要Mux?
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?
我理想的过滤器应为:
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.
您可以将视频基本流保存到文件中,但可以使用转储过滤器示例,而不是文件编写器。文件编写器有一个特殊的协议,允许多路复用器随机访问文件(使用时间戳作为文件偏移量)。您只想将数据另存为流,然后使用转储示例。
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屋!