Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
524 views
in Technique[技术] by (71.8m points)

video - DirectShow Record Problem - fps

I just create simple graph to record video from a source Filter:

SourceFilter ---> Muxer ---> FileWriter

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" :-).

It is sure that there is fps (frame persecond) problem. How can i fix it? any ideas?

PS:

To check if my SourceFilter give righ fps i simply create another graph:

SourceFilter ---> Video Decoder ---> Video Renderer

and it plays at right speed (fps)

More Details:

SourceFilter(*.mp4 file format) ---> Avi Mux Filter ---> File writer Filter

This record but in wrong 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

The other scenario

SourceFilter( *.h264 file format) ---> Avi Mux Filter ---> File writer Filter
SourceFilter( *.h264 file format) ---> GDCL MPEG 4 Mux Filter---> File writer Filter

It records but recorded file does not play.

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...