[FFmpeg-user] ffmpeg recording RTSP stream with audio out of sync

Dave Hess dha4t.ffmpeg at gmail.com
Tue Jul 19 16:01:30 EEST 2016


> I am having a problem with the video / audio sync when recording from an
> RTSP stream with ffmpeg.


> The result seems leave the video and audio out of sync in Windows Media
> Player (which unfortunately is the application I need to use for this), where
> as VLC seems to be able to cope with this and rectifies the problem.

Andy,

I have a similar (if not exact same) problem when copying an RTSP stream.  I've also verified the different behavior in Windows Media Player and VLC.  The workaround I found was to run the resultant video through an ffmpeg process using -ss 0 -i input -c copy which seems to bring the audio and video back into sync.  It's a quick "copy" process.  No need to find the exact offset as -ss 0 seemed to work no matter what amount of offset there was.  My theory is that ffmpeg waits until a keyframe before copying video, but audio starts copying right away which causes audio to lag video (video is pulled forward to fill the non-keyframe gap).  The -copyinkf (copy initial non-keyframe) parameter didn't have any affect for me.  Again, only a theory.  I'm just a user, not a developer.

Dave



More information about the ffmpeg-user mailing list