本文介绍了GMFBridge DirectShow滤镜SetLiveTiming效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在使用出色的,并且多路复用器过滤器开始生成输出文件,但是音频未与视频同步. and the muxer filter began producing an output file, however, the audio was not synchronized to the video.UPDATE 2: The dropped samples were introduced by the way I launched the secondary (muxer) graph. I inspected a sample using a SampleGrabber (thus inside a streaming thread) as a trigger-point and used a Task.Run() .NET call to instantiate the muxer graph. This somehow messed up the clocks and I ended having a 'reference start point' in the future - when the bridge attempted to fix the timestamp by subtracting the reference start point, it produced a negative timestamp - once I corrected this and spawned the graph from the application thread (by posting a graph event), the problem was fixed.Unfortunately, my multiplexed video (regardless of the SetLiveTiming() setting) is still out of sync.I read that the GMFBridge filter can have trouble when the InfTee filter is being used, however, I think that my graph shouldn't have this problem, as no instance of the InfTee filter is directly connected to the bridge sink.Here is my current source graph: -->[TIF] | [NetworkProvider]-->[DigitalTuner]-->[DigitalCapture]-->[demux]--|-->[Mpeg Tables] | |-->[lavAudioDec]-->[tee]-->[audioConvert]-->[sampleGrabber]-->[NULL] | | | | | ->[aacEncoder]---------------- | |--->[*Bridge Sink*] -->[VideoDecoder]-->[sampleGrabber]-->[x264Enc]--------Here is my muxer graph: video ... |bridge source|-------->[MP4 muxer]--->[fileWriter] | ^ | audio | ---------------------All the sample grabbers in the graph are read-only. If I mux the output file without bridging (by placing the muxer on the capture graph), the output file remains in sync, (this ended being not true, the out-of-sync problem was introduced by a latency setting in the H264 encoder) but then I can't avoid losing some seconds between releasing the current capture graph, and running the new one (with the updated file name)UPDATE 3:The out of sync problem was inadvertently introduced by me several days ago, when I switched off a "Zero-latency" setting in the x264vfw encoder. I hadn't noticed that this setting had desynchronized my already-working graphs too and I was blaming the bridge filter.In summary, I screwed up things by:Launching the muxer graph from a thread other than the Applicationthread (the thread processing the graph's event loop).A latency switch in an upstream filter that was probably delayingthings too much for the muxer to be able to keep-up. 解决方案 Author's comment:// using this option, you can share a common clock// and avoid any time mapping (essential if audio is in mux graph)[id(13), helpstring("Live Timing option")]HRESULT SetLiveTiming([in] BOOL bIsLiveTiming);The method enables a special mode of operation which addresses live data. In this mode sample times are converted between the graphs as relative to respective clock start times. Otherwise, the default mode is to expect reset of time stamps to zero with graph changes. 这篇关于GMFBridge DirectShow滤镜SetLiveTiming效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-04 22:54