[FFmpeg-devel] Audio Video Sync issue with dvr-ms files

Jonathon Elwood jaelwood
Tue May 1 20:47:31 CEST 2007


On 4/3/07, Jonathon Elwood <jaelwood at gmail.com> wrote:
>
>
> There is an AV sync issue with the latest SVN (8618).   I've uploaded a
> sample file that demonstrates this issue to:
>
> ftp://upload.mplayerhq.hu/MPlayer/incoming/Backpackers -
> _23_03_2007_23_00_03_comms.dvr-ms
>
> Michael Niedermayer recommended that I test with previous versions of ffmpeg
> and find the patch that broke the AV sync.   I traced the problem to patch
> #7905.  ffmpeg 7904 worked fine, but 7905 and above demonstrate this AV sync
> issue.   I modified the latest SVN to reverse the changes made in patch
> 7905, and the AV sync looks good.  However, this obviously isn't a proper
> fix.   Also without the changes in patch 7905 I have other dvr-ms shows
> where the fps is detected incorrectly, so this patch is obviously needed.
> Could you please look at this?   I'm not sure what the code in patch 7905 is
> doing, so I won't be able to create the appropriate patch.
>

I have been working with John Donaghy trying to solve the problems I
reported above (thanks John for all your help).  I've made some
progress fixing the timestamps (the video isn't "freezing" and the fps
is detected correctly on all shows now); however, the video frames
before the first keyframe are being discarded.  This is leading to a
bad AV sync issue because the audio starts from the beginning of the
stream, but the video starts from the first Key Frame.
I've attached two patches (one to asf.c and the other to asf.h)
showing the changes I've made so far.  These patches obviously aren't
ready for submission so please be kind, this is obviously still a work
in progress.  I've also attached a debug log file showing the output
of my debug statements.
My questions are:
1) If you look at the debug.txt file you will see the timestamps I'm
now allocating to each segment.  However, I'm not sure what to do with
the video segments before the first Key Frame.  My guess is I need to
do something special to these timestamps so the frames aren't
discarded, but what?  Right now I'm just setting them to
AV_NOPTS_VALUE, however, they are being discarded.  I tried setting a
value on the new segments, however, there was a big jump in the
timestamp values once I got to the first Key Frame and they were
discarded anyway.  So, I need to know what to do with these sequences.
 John suggested I just discard both the audio and video sequences
until I get to the Video Key Frame.  I don't know how to do this, is
there a mechanism in place to make this easy?
2) If you look at the segments marked "audio timestamp" you will
notice that the audio is split into two segments.  I'm assigning the
timestamp to the first segment, and setting the second segment to
AV_NOPTS_VALUE.  Is this correct, or should the second segment also
have a timestamp?  If the second segment has to have a timestamp, then
what timestamp do I use (if I read the timestamp from the file, it is
the same timestamp as the first segment)?
3) Should both audio segments have the Key Frame flag set, or should I
remove the Key Frame flag from the second segment?

If there is anything else you see wrong regarding the timestamps I've
allocated please let me know.  I've learned a lot, but all of this is
still new to me.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: asf.c patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070501/8ec9c6b2/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: asf.h patch
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070501/8ec9c6b2/attachment.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Debug.txt
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070501/8ec9c6b2/attachment-0001.txt>



More information about the ffmpeg-devel mailing list