DirectShow图形中的视频延迟 [英] Delay in video in DirectShow graph

查看:141
本文介绍了DirectShow图形中的视频延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到一个引人注目的视频,导致正在测试的捕获卡的音频/视频同步关闭.我的图拓扑如下.

I'm seeing a noticeable video which is causing the resulting audio/video sync to be off for a capture card that I'm testing. My graph topology is as follows.

Video Source -> Sample Grabber -> Null Renderer

Audio Source -> Sample Grabber -> Null Renderer

使用H264压缩视频中的样本,并使用FAAC压缩音频.此拓扑和应用程序代码适用于我过去使用的采集卡.但是我正在测试的当前卡上看到了这种延迟.我自然认为它与卡本身有关.因此,我检查并发现使用Open Broadcaster,VLC或GraphEdit中的同一图形使用此卡捕获时没有视频/音频失步.

The samples from video is compressed using H264, and Audio is compressed using FAAC. This topology and application code works for capture cards that I've used in the past. But I see this delay with the current card that I'm testing. Naturally I thought it was related to the card itself. So I checked and found that there is no video/audio desync when using Open Broadcaster, VLC, or the same graph in GraphEdit to capture with this card.

这向我表明该问题与我如何构造图形有关.然后,我尝试使用IAMBufferNegotiationSetStreamSyncOffset调整缓冲区大小,但没有成功.

This indicates to me that the problem is related to how I'm constructing the graph. I then tried adjusting the buffer sizes using IAMBufferNegotiation, as well as SetStreamSyncOffset without success.

如果我对视频应用500毫秒的延迟(例如videoTimeStamp = videoTimeStamp - 500),则同步几乎是完美的.这很奇怪,因为我希望音频中的延迟比视频中的延迟更多.

The sync is almost perfect if I apply a 500 ms lag to the video (e.g. videoTimeStamp = videoTimeStamp - 500). This is strange because I would expect to see more latency in the audio than video.

推荐答案

视频和音频同步都与时间戳有关.视频或音频段可能会延迟数据处理,但是时间戳显示原始同步和预期同步.

Video and audio synchronization is all about time stamps. Video or audio leg might delay processing of data, but it is time stamps that show original and intended sync.

潜在原因包括:

  1. 视频和音频源独立地为数据添加时间戳,错误地传递了未同步的数据-看起来不像您的情况
  2. 您忽略了时间戳,而是使用了样品到达采集卡器的实际时间,这是不正确的
  3. 介于两者之间的另一个过滤器(例如解码器)在处理数据时会错误地重采样数据

这篇关于DirectShow图形中的视频延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆