diff --git a/ffmpeg.c b/ffmpeg.c
index e5e2d0a5a8faa7b17769b43f1a877ae05871c521..289223c5af639b5f103f52052e690b62ba9c70ed 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -595,7 +595,7 @@ static void do_video_out(AVFormatContext *s,
         double adelta, vdelta, av_delay;
 
         adelta = audio_sync->sync_ipts - ((double)audio_sync->sync_opts * 
-            ost->st->time_base.num / ost->st->time_base.den);
+            audio_sync->st->time_base.num / audio_sync->st->time_base.den);
 
         vdelta = ost->sync_ipts - ((double)ost->sync_opts *
             ost->st->time_base.num / ost->st->time_base.den);