[FFmpeg-trac] #1645(avformat:new): Duration calculation error when -ss precedes -i

FFmpeg trac at avcodec.org
Mon Aug 20 12:29:15 CEST 2012


#1645: Duration calculation error when -ss precedes -i
-------------------------------------+-------------------------------------
             Reporter:  cheedoong    |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  important    |                Component:  avformat
              Version:  git-master   |               Resolution:
             Keywords:  Duration     |               Blocked By:
  error; ss before i                 |  Reproduced by developer:  0
             Blocking:               |
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------

Comment (by burek):

 This is not a bug, but rather expected behavior. The reason for your issue
 is that you didn't quite understand how -ss works. Reading the
 [http://ffmpeg.org/ffmpeg.html#Main-options documentation], you can see
 that:

  '''‘-ss position (input/output)’'''
  When used as an input option (before -i), seeks in this input file to
 position. When used as an output option (before an output filename),
 decodes but discards input until the timestamps reach position. This is
 slower, but more accurate. Position may be either in seconds or in
 hh:mm:ss[.xxx] form.

 What does it say is actually this:
 - When -ss is used before -i option (as an input option), it makes ffmpeg
 seek very fast, using only key frames (which may be arranged every 30
 seconds, for example). This is ultra fast, but obviously, not very
 accurate
 - When -ss is used after -i option (or more precisely, before the output
 file name specification), it makes ffmpeg seek very slowly but extremely
 accurate (it reads decoded video frames, one by one, dropping them all
 until the specified point in time is reached)

 This would explain why everything magically works when you use both -ss
 before and after -i option.

 One more misunderstanding is regarding -t option. If you specify -t 15,
 the output file duration will be 15 seconds, not 10, obviously. That you
 can check also in the [http://ffmpeg.org/ffmpeg.html#Main-options
 documentation]:

  '''‘-t duration (output)’'''
  Stop writing the output after its duration reaches duration. duration may
 be a number in seconds, or in hh:mm:ss[.xxx] form.

 So, I believe this bug can safely be closed, if you agree.

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1645#comment:1>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list