简体   繁体   中英

Delay in video in DirectShow graph

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

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.

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.

The sync is almost perfect if I apply a 500 ms lag to the video (eg 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.

Potential causes include:

  1. Video and audio sources timestamp data independently, incorrectly delivering unsynchronized data - does not look like your case
  2. You neglect time stamps and you use actual time of sample arrival to your sample grabber, which is incorrect
  3. Another filter in between, such as decoder, incorrectly restamps data when processes it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM