Opened 10 years ago

Last modified 10 years ago

#3680 new defect

can't seek to a key frame

Reported by: hxuanyu Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I built a test program with latest git header (commit 8518da23f59d8f5a52f7c1c919f584a119484d0f)

the test program

  1. read out video packet and decode one by one until no video frame can be decoded
  2. call av_seek_frame() to seek to the beginning of the file
  3. do read and decode again

Here is part of the log: you can see that 2 rounds of read/decode return different results

rhbc73 pFormatCtx->start_time = 600000000
packet 0 [DTS: 53996997 PTS: 54000000, Key=yes]
packet 1 [DTS: 54000000 PTS: 54000000, Key=no]
packet 2 [DTS: 54003003 PTS: 54009009, Key=no]
packet 3 [DTS: 54006006 PTS: 54006006, Key=no]
packet 4 [DTS: 54009009 PTS: 54015015, Key=no]
packet 5 [DTS: 54012012 PTS: 54012012, Key=no]
packet 6 [DTS: 54015015 PTS: 54021021, Key=no]
packet 7 [DTS: 54018018 PTS: 54018018, Key=no]

video_frame n:0 coded_n:4 Packet.dts = 54018018, pFrame->pkt_dts = 54012012, best timestamp = 54000000

packet 8 [DTS: 54021021 PTS: 54030030, Key=no]

video_frame n:1 coded_n:8 Packet.dts = 54021021, pFrame->pkt_dts = 54015015, best timestamp = 54006006

packet 9 [DTS: 54024024 PTS: 54024024, Key=no]

video_frame n:2 coded_n:7 Packet.dts = 54024024, pFrame->pkt_dts = 54018018, best timestamp = 54009009

seek 0 maps to 54000000 seek 0 ok

packet 89 [DTS: 54000000 PTS: 54000000, Key=no]
packet 90 [DTS: 54003003 PTS: 54009009, Key=no]
packet 91 [DTS: 54006006 PTS: 54006006, Key=no]
packet 92 [DTS: 54009009 PTS: 54015015, Key=no]
packet 93 [DTS: 54012012 PTS: 54012012, Key=no]
packet 94 [DTS: 54015015 PTS: 54021021, Key=no]
packet 95 [DTS: 54018018 PTS: 54018018, Key=no]
packet 96 [DTS: 54021021 PTS: 54030030, Key=no]
packet 97 [DTS: 54024024 PTS: 54024024, Key=no]
packet 98 [DTS: 54027027 PTS: 54027027, Key=no]
packet 99 [DTS: 54030030 PTS: 54039039, Key=no]
packet 100 [DTS: 54033033 PTS: 54033033, Key=no]
packet 101 [DTS: 54036036 PTS: 54036036, Key=no]
packet 102 [DTS: 54039039 PTS: 54048048, Key=no]
packet 103 [DTS: 54042042 PTS: 54042042, Key=no]
packet 104 [DTS: 54045045 PTS: 54045045, Key=no]
packet 105 [DTS: 54048048 PTS: 54057057, Key=no]
packet 106 [DTS: 54051051 PTS: 54051051, Key=no]
packet 107 [DTS: 54054054 PTS: 54054054, Key=no]
packet 108 [DTS: 54057057 PTS: 54066066, Key=no]
packet 109 [DTS: 54060060 PTS: 54060060, Key=no]
packet 110 [DTS: 54063063 PTS: 54063063, Key=no]
packet 111 [DTS: 54066066 PTS: 54075075, Key=no]
packet 112 [DTS: 54069069 PTS: 54069069, Key=no]
packet 113 [DTS: 54072072 PTS: 54072072, Key=no]
packet 114 [DTS: 54075075 PTS: 54084084, Key=no]
packet 115 [DTS: 54078078 PTS: 54078078, Key=no]
packet 116 [DTS: 54081081 PTS: 54081081, Key=no]
packet 117 [DTS: 54084084 PTS: 54093093, Key=yes]
packet 118 [DTS: 54087087 PTS: 54087087, Key=no]
packet 119 [DTS: 54090090 PTS: 54090090, Key=no]
packet 120 [DTS: 54093093 PTS: 54102102, Key=no]
packet 121 [DTS: 54096096 PTS: 54096096, Key=no]
packet 122 [DTS: 54099099 PTS: 54099099, Key=no]
packet 123 [DTS: 54102102 PTS: 54111111, Key=no]
packet 124 [DTS: 54105105 PTS: 54105105, Key=no]
packet 125 [DTS: 54108108 PTS: 54108108, Key=no]

video_frame n:88 coded_n:126 Packet.dts = 54108108, pFrame->pkt_dts = 54102102, best timestamp = 54093093

Attachments (2)

ffmpeg.c (137.2 KB ) - added by hxuanyu 10 years ago.
test code (my own test code put into main function of ffmpeg.c)
output.txt (27.4 KB ) - added by hxuanyu 10 years ago.

Download all attachments as: .zip

Change History (3)

by hxuanyu, 10 years ago

Attachment: ffmpeg.c added

test code (my own test code put into main function of ffmpeg.c)

by hxuanyu, 10 years ago

Attachment: output.txt added
Note: See TracTickets for help on using tickets.