[FFmpeg-devel] [PATCH 6/6] lavf: count skipped samples for initial timestamps.
Nicolas George
nicolas.george at normalesup.org
Thu Jul 19 23:56:38 CEST 2012
Le duodi 2 thermidor, an CCXX, Michael Niedermayer a écrit :
> > [PACKET] [PACKET]
> > pts=0 (0.000000) pts=-25 (-0.025000)
> > dts=0 (0.000000) dts=-25 (-0.025000)
>
> > dur=N/A (N/A) dur=26 (0.026000)
>
> do you know why this changes ?
> its not wrong but unexpected ...
It looks like the Matroska demuxer does not like negative timestamps:
if (cluster_time != (uint64_t)-1
&& (block_time >= 0 || cluster_time >= -block_time)) {
timecode = cluster_time + block_time;
(libavformat/matroskadec.c, line 1881)
timecode is what will later be stored in pkt->pts.
With the current code (pts=0), cluster_time=0 and block_time=0, timecode is
set to 0.
With the modified code (pts=-25), cluster_time=0 and block_time=-25,
timecode is not set. Consequence: find_stream_info reads one more packet to
get a first_dts.
This test goes back to the initial commit of the Matroska demuxer (now known
as 08abe0f). mkvinfo shows this:
SimpleBlock (key, track number 1, 1 frame(s), timecode 18446744027.136s = 00:00:00.-25)
I have to delve in the spec, but either the muxer is producing invalid
Matroska files or the demuxer is ignoring perfectly valid timestamps.
There is something else that seems strange: adding debug, I get this for the
very first packet:
parsing packet: size=417 trivhash=1ca95b60
parsing result: index=417 duration=0
decoding packet: size=417 trivhash=1ca95b60
decoding result: ret=417 got_frame=1 nb_samples=1152
It looks like the parser accepts the whole packet and predicts 0 samples
while the decoder outputs 1152. I put a hexdump of the full packet at the
end of this mail.
> That should be ok, i was affraid that the change might leak through
> when there are timestamps later but from a second look i cant see
> how this could happen unless they come "too late" in which case the
> initial ones are arbitrary anyway
Ok, thanks. I just pushed the series.
Regards,
--
Nicolas George
Hexdump of the packet that the parser and decoder disagree on:
00000000: fffb 9064 000f f000 0069 0000 0008 0000 ...d.....i......
00000010: 0d20 0000 0100 0001 a400 0000 2000 0034 . .......... ..4
00000020: 8000 0004 4c41 4d45 332e 3939 2e35 5555 ....LAME3.99.5UU
00000030: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
00000040: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
00000050: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
00000060: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
00000070: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
00000080: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
00000090: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
000000a0: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
000000b0: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
000000c0: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
000000d0: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
000000e0: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
000000f0: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
00000100: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
00000110: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
00000120: 4c41 4d45 332e 3939 2e35 5555 5555 5555 LAME3.99.5UUUUUU
00000130: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
00000140: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
00000150: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
00000160: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
00000170: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
00000180: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
00000190: 5555 5555 5555 5555 5555 5555 5555 5555 UUUUUUUUUUUUUUUU
000001a0: 55 U
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120719/19301b3a/attachment.asc>
More information about the ffmpeg-devel
mailing list