[FFmpeg-devel] Audio Video Sync issue with dvr-ms files
Michael Niedermayer
michaelni
Sat May 12 18:31:18 CEST 2007
Hi
On Sat, May 12, 2007 at 09:15:33AM -0400, Jonathon Elwood wrote:
> On 5/12/07, Michael Niedermayer <michaelni at gmx.at> wrote:
> >Hi
> >
> >On Fri, May 11, 2007 at 11:26:00PM -0400, Jonathon Elwood wrote:
> >> On 5/11/07, Michael Niedermayer <michaelni at gmx.at> wrote:
> >> > Hi
> >> [...]
> >>
> >> > ive tried these files and i cannot reproduce any freezing frames with
> >> > svn head ffplay with them, also their AV sync is not worse with ffplay
> >> > then any other random mpeg2 video
> >> >
> >> > can someone confirm that there is any problem at all with these files?
> >> You are correct, I just tried it with ffplay and it played perfectly.
> >> I'm embarrassed that I didn't try ffplay earlier (I thought of trying
> >> it with MPlayer, but not ffplay). Anyway, I think this helps narrow
> >> down the problem because the problem must be somewhere in the encoding
> >> process. Please try it again with ffmpeg and you should see the
> >> problem. I tried it with both command lines below and I see the
> >> problem with both encoders.
> >>
> >> ffmpeg -benchmark -y -i "ABC_SD.dvr-ms" -vcodec mpeg4 -qscale 4 -vtag
> >> XVID -acodec mp3 -ac 2 -ab 128000 -f avi "ABC_SD.avi"
> >>
> >> ffmpeg -y -benchmark -i "ABC_SD.dvr-ms" -threads 2 -vcodec h264 -b
> >> 384000 -bufsize 384 -coder 0 -level 13 -acodec aac "ABC_SD.mp4"
> >
> >-dts_delta_threshold 1
> >
> >though this is more a workaround than a proper solution, the problem is
> >likely that the first frames have no timestamps
> >maybe theres some initial timestamp hidden somewhere in asf?
> >if not iam wondering how wmp can play it? or does wmp discard the first
> >frame(s) ?
> >
> The ?dts_delta_threshold 1 option kind of works? The video isn't
> frozen for 8 seconds, but the AV isn't in sync.
> I tried playing the samples in wmp and I don't see wmp discarding any
> frames. Actually, when I play the file in wmp or ffplay it looks
> exactly the same. Since they look the same, it doesn't look like
> either wmp or ffplay throws away the first frames (unless they both
> are throwing away the same frames...).
> I've attached two debug files that are interesting. The first, is
> ABC_HD.txt. This shows the timestamps from a show that ffmpeg can
> convert just fine. Notice the difference from the first audio
> timestamp to the first video timestamp is 660. Then the second file
> is the ABC_SD.txt file. This is the debug from the ABC_SD.dvr-ms
> file. The difference here between the first audio timestamp and the
> first video timestamp is 707. Not a big difference? I wouldn't
> expect this difference to cause the first frame to be stuck for 8
> seconds on the ABC_SD file, but everything to convert just fine with
> the ABC_HD file (if you want to see the ABC_HD file let me know and
> I'll upload it).
> Anyway, I can keep looking, but I don't think there are any other
> timestamps in the file. Since wmp and ffplay can both play the file
> just fine without the beginning timestamps, my guess is no other
> timestamps exist because they aren't needed just to play the file.
> However, since they appear to be needed for encoding, what would be
> the proper thing to do with the timestamps? I tried setting the first
> video packet to a timestamp of zero, but that didn't work. All the
> packet fragments we get before the first timestamp is all one segment.
> Because of this, I don't think there is any way to interpolate the
> timestamps before we get to the real timestamps.
there is you just have to subtract the timestamp discontinuity at the
occurance of the first valid timestamp from the initial cur_dts
somewhere in av_find_stream_info()
also see the disscussions with wolfram on the mailinglist, some
of them where related to this, though not related to dvr-ms
also your debuging information is wrong, more specifically the
packet_key_frame is complete nonsense
see, following are the true frame types as output by the parser,
1 are key frames, the file is ABC_SD.dvr-ms
audio 7431 -9223372036854775808 type:1
audio -9223372036854775808 -9223372036854775808 type:1
audio -9223372036854775808 -9223372036854775808 type:1
video -9223372036854775808 -9223372036854775808 type:1
video -9223372036854775808 -9223372036854775808 type:3
video -9223372036854775808 -9223372036854775808 type:3
audio 7559 -9223372036854775808 type:1
audio -9223372036854775808 -9223372036854775808 type:1
audio -9223372036854775808 -9223372036854775808 type:1
video -9223372036854775808 -9223372036854775808 type:2
video -9223372036854775808 -9223372036854775808 type:3
video -9223372036854775808 -9223372036854775808 type:3
audio 7655 -9223372036854775808 type:1
audio -9223372036854775808 -9223372036854775808 type:1
audio -9223372036854775808 -9223372036854775808 type:1
video -9223372036854775808 -9223372036854775808 type:2
video -9223372036854775808 -9223372036854775808 type:3
video 8138 -9223372036854775808 type:3
audio 7751 -9223372036854775808 type:1
audio -9223372036854775808 -9223372036854775808 type:1
audio -9223372036854775808 -9223372036854775808 type:1
audio 7847 -9223372036854775808 type:1
audio -9223372036854775808 -9223372036854775808 type:1
audio -9223372036854775808 -9223372036854775808 type:1
this shows clearly that the file begins with key frames like one would
expect
PS: maybe you want to document the things you found out about dvr-ms
on the multimedia wiki?
[...]
> Audio asf->packet_seq=1 - asf->packet_frag_timestamp=7431.000000 - ts0=74315782.000000 - asf->packet_key_frame=1
> Video asf->packet_seq=1 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=1 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=2 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=2 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=3 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=3 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=4 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=4 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=5 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=5 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=6 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=6 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=7 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=8 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=8 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=9 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=10 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=10 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Audio asf->packet_seq=2 - asf->packet_frag_timestamp=7559.000000 - ts0=75595782.000000 - asf->packet_key_frame=1
> Audio asf->packet_seq=2 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=75595782.000000 - asf->packet_key_frame=1
> Video asf->packet_seq=11 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=11 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=12 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=12 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=13 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=13 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=14 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=14 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=15 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=15 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=16 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=16 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=17 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=18 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=18 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=19 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=20 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=20 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=21 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=21 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=22 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Audio asf->packet_seq=3 - asf->packet_frag_timestamp=7655.000000 - ts0=76555782.000000 - asf->packet_key_frame=1
> Audio asf->packet_seq=3 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=76555782.000000 - asf->packet_key_frame=1
> Video asf->packet_seq=23 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=23 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=24 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=24 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=25 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=25 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=26 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=26 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=27 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=27 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=28 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=29 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=30 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=30 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=31 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=32 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=33 - asf->packet_frag_timestamp=8138.000000 - ts0=81389226.000000 - asf->packet_key_frame=1
> Video asf->packet_seq=33 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=81389226.000000 - asf->packet_key_frame=0
> Video asf->packet_seq=34 - asf->packet_frag_timestamp=-9223372036854775800.000000 - ts0=-1.000000 - asf->packet_key_frame=0
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070512/802fc72a/attachment.pgp>
More information about the ffmpeg-devel
mailing list