简体   繁体   English

音频和视频不同步?

[英]Audio and Video are out of sync?

I'm using nVLC as vlc wrapper to render rtsp video stream to memory, and then raise events for NewFrame (audio and Video). 我使用nVLC作为vlc包装器将rtsp视频流呈现到内存,然后引发NewFrame(音频和视频)事件。 in the class that capture those events. 在捕获这些事件的类中。 I've used Accord.Video.FFMPEG.VideoFileWriter to write the frame, and audio bytes (or signal). 我已经使用Accord.Video.FFMPEG.VideoFileWriter来编写帧和音频字节(或信号)。 but unfortunately I keep having delay between audio and video. 但不幸的是,我在音频和视频之间一直存在延迟。 I've tried to trace that delay and come up with the following: 我试图追踪这种延迟并提出以下建议:

1- the delay is different from stream to stream. 1-延迟因流而异。 ie for one stream it's about 1800 ms (audio leads), for another one it's about 3000 ms(audio leads too). 即,对于一个流,它约为1800毫秒(音频引线),对于另一个流,它约为3000毫秒(音频引线)。

2- the delay is independent of the delay between capturing frames and capturing audio signals. 2-延迟与捕获帧和捕获音频信号之间的延迟无关。

3- the delay is independent of the delay between capturing video NewFrame event and capturing audio NewFrame event. 3-延迟与捕获视频NewFrame事件和捕获音频NewFrame事件之间的延迟无关。

4- delay is independent of the internet connection speed. 4-延迟与互联网连接速度无关。

any help in solving this problem would be appreciated. 解决这个问题的任何帮助将不胜感激。

Thanks 谢谢

The best shot I've got was by using the audio stream as the leading stream ie never record frames from video stream until the frame time is greater than or equals the first recorded audio frame. 我获得的最佳拍摄是通过使用音频流作为前导流,即在帧时间大于或等于第一个记录的音频帧之前,才记录视频流中的帧。 the PTS (Presentation Time Stamp) of sound frame as is when capture, but the PTS of image is calculated depending on the player.Time (ms) and by using a stopwatch which is reset every time the player.Time has changed (in TimeChanged event). 捕获时声音帧的PTS(演示时间戳),但图像的PTS取决于播放器。时间(ms)并使用秒表,每次播放器都会重置秒表。时间已更改(在TimeChanged中事件)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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