[FFmpeg-trac] #5093(ffmpeg:open): Accurate seek not possible with MPEG program stream and transport sream

FFmpeg trac at avcodec.org
Fri Jan 22 10:45:15 CET 2016


#5093: Accurate seek not possible with MPEG program stream and transport sream
------------------------------------+----------------------------------
             Reporter:  pkerling    |                    Owner:
                 Type:  defect      |                   Status:  open
             Priority:  normal      |                Component:  ffmpeg
              Version:  git-master  |               Resolution:
             Keywords:              |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+----------------------------------

Comment (by pkerling):

 As a workaround:

 {{{
 ffmpeg -ss 3.000 -itsoffset -2.000 -copyts -i test.mpg -frames:v 1
 test.png
 }}}

 with the `-ss` value set to two seconds before the requested time gives
 the correct frame in almost all cases I've tested, the exception being a
 WMV file with duplicated frames at the beginning (the "normal" way is
 failing there, too). This then seeks to two seconds before the requested
 frame to make sure it is not accidentally skipped and then skips two
 seconds of unwanted frames by adjusting the input timestamps. The
 timestamp offset should be set bigger than the maximum expected keyframe
 interval.
 That this works depends on a lot of ffmpeg internals like the trim filter
 automatically inserted and how copyts is handled, but I can recommend this
 command as the most exact way of extracting a frame known to me as of
 FFmpeg 2.8.5. Also, the `-ss` option is necessary even if set to 0.000, or
 the frame might be wrong.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/5093#comment:8>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list