[FFmpeg-trac] #3716(undetermined:new): ffmpeg can't seek to start of a mpeg video

FFmpeg trac at avcodec.org
Wed Jun 11 05:12:37 CEST 2014


#3716: ffmpeg can't seek to start of a mpeg video
-------------------------------------+-------------------------------------
             Reporter:  hxuanyu      |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:               |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 This issue can be reproduced using
 ffmpeg version N-63861-g958168d Copyright (c) 2000-2014 the FFmpeg
 developers
   built on Jun  9 2014 22:02:00 with gcc 4.8.2 (GCC)
   configuration: --enable-gpl --enable-version3 --disable-w32threads
 --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
 --enable-gnutls --enable-iconv --enable-libass --enable-libbluray
 --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm
 --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-
 libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
 --enable-libopus --enable-librtmp --enable-libschroedinger --enable-
 libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-
 libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-
 libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-
 libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-
 decklink --enable-zlib
   libavutil      52. 89.100 / 52. 89.100
   libavcodec     55. 66.100 / 55. 66.100
   libavformat    55. 42.101 / 55. 42.101
   libavdevice    55. 13.101 / 55. 13.101
   libavfilter     4.  7.100 /  4.  7.100
   libswscale      2.  6.100 /  2.  6.100
   libswresample   0. 19.100 /  0. 19.100
   libpostproc    52.  3.100 / 52.  3.100

 steps to reproduce.
 1. convert attached mp4 into mpg:  ffmpeg.exe -i "numbers fps 25.mp4"
 25.mpg
 2. convert generated mpg to mp4 using -ss 0: ffmpeg.exe -ss 0 -i 25.mpg
 25.mp4

 then you can easily find that 25.mp4 doesn't start with the correct frame
 (original mp4 is a video with frames showing number 000 to 499, but 25.mp4
 starts with 12)

 I also spent little time to debug. seems the mpg file converted from mp4
 has a non-zero offset

 rhbc73 videostreamoffset = 48600
 rhbc73 debug[V], ProcessVideoPacket, [DTS:45000 PTS:48600] KEY FRAME
 rhbc73 debug[V], ProcessVideoPacket, [DTS:48600 PTS:52200]
    rhbc73 debug[V]: get a complete frame [0] Best time:[48600 - 48600] =
 [0] = 0.000000
 rhbc73 debug[V], ProcessVideoPacket, [DTS:52200 PTS:55800]
       rhbc73 debug[V]: get a complete frame [1] Best time:[52200 - 48600]
 = [3600] = 0.040000
 rhbc73 debug[V], ProcessVideoPacket, [DTS:55800 PTS:59400]
       rhbc73 debug[V]: get a complete frame [2] Best time:[55800 - 48600]
 = [7200] = 0.080000
 rhbc73 debug[V], ProcessVideoPacket, [DTS:59400 PTS:63000]
       rhbc73 debug[V]: get a complete frame [3] Best time:[59400 - 48600]
 = [10800] = 0.120000
 rhbc73 debug[V], ProcessVideoPacket, [DTS:63000 PTS:66600]
       rhbc73 debug[V]: get a complete frame [4] Best time:[63000 - 48600]
 = [14400] = 0.160000
 rhbc73 debug[V], ProcessVideoPacket, [DTS:66600 PTS:70200]
       rhbc73 debug[V]: get a complete frame [5] Best time:[66600 - 48600]
 = [18000] = 0.200000
 rhbc73 debug[V], ProcessVideoPacket, [DTS:70200 PTS:73800]
       rhbc73 debug[V]: get a complete frame [6] Best time:[70200 - 48600]
 = [21600] = 0.240000
 rhbc73 debug[V], ProcessVideoPacket, [DTS:73800 PTS:77400]
       rhbc73 debug[V]: get a complete frame [7] Best time:[73800 - 48600]
 = [25200] = 0.280000
 rhbc73 debug[V], ProcessVideoPacket, [DTS:77400 PTS:81000]
       rhbc73 debug[V]: get a complete frame [8] Best time:[77400 - 48600]
 = [28800] = 0.320000
 rhbc73 debug[V], ProcessVideoPacket, [DTS:81000 PTS:84600]
       rhbc73 debug[V]: get a complete frame [9] Best time:[81000 - 48600]
 = [32400] = 0.360000
 rhbc73 debug[V], ProcessVideoPacket, [DTS:84600 PTS:88200]
       rhbc73 debug[V]: get a complete frame [10] Best time:[84600 - 48600]
 = [36000] = 0.400000
 rhbc73 debug[V], ProcessVideoPacket, [DTS:88200 PTS:91800] KEY FRAME
       rhbc73 debug[V]: get a complete frame [11] Best time:[88200 - 48600]
 = [39600] = 0.440000
 rhbc73 debug[V], ProcessVideoPacket, [DTS:91800 PTS:95400]
       rhbc73 debug[V]: get a complete frame [12] Best time:[91800 - 48600]
 = [43200] = 0.480000

 videostreamoffset = pFormatCtx->start_time, so we can see offset is in
 pts. if I call av_seek_frame(48600, AVSEEK_FLAG_BACKWARD) then
 I couldn't get a complete frame until [DTS:88200 PTS:91800] KEY FRAME
 packet is readout, but if I call av_seek(45000, AVSEEK_FLAG_BACKWARD) then
 I could successfully. This means seek is based on dts?

--
Ticket URL: <https://trac.ffmpeg.org/ticket/3716>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list