[FFmpeg-user] Decimal times to frame numbers

Nicolas George george at nsup.org
Sat Aug 21 12:35:52 EEST 2021


amindfv--- via ffmpeg-user (12021-08-20):
> I then tested the output of running commands like this, only changing the value for $STARTTIME :
> 
>     export STARTTIME=0.33 ; ffmpeg -r 24 -i color-frames.mp4 -r 24 -ss $STARTTIME "test-$STARTTIME.mp4"

There are several flaws in problem report:

- You did not post the full output. We need the full output to spot some
  usual missteps.

- You do not need export since you are using the variable directly.

- By adding -r on your input, your force ffmpeg to re-synthesize the
  timestamps. This is wrong in general. In this particular case, it
  changes the precision of the timestamps: your input file has a 1/12288
  time base, with -r 24 it becomes 1/24.

- By adding -r on your output and by using a format like MP4 that only
  supports constant frame rate, you are forcing ffmpeg to duplicate or
  drop frames to a certain rate. If you want to examine the output
  carefully, either use a format that supports arbitrary timestamps or
  do not use a format at all and write to individual images with "-vsync
  passthrough".

It is possible you have unearthed an off-by-one bug somewhere. But in
general, the logic should be:

- The timestamps you write are rounded to the nearest integer multiple
  of the time base.

- The frames you get in the filter line are exactly the interval you
  requested. That means if the time base is more precise than the frame
  rate you can get frames with half the duration.

What happens after the filter chain, on the other hand, is subject to
more complex heuristics. I strongly suggest you try to work as much as
possible only with filters.

> On Wed, Aug 18, 2021 at 09:26:03PM -0600, amindfv--- via ffmpeg-user wrote:

Top-posting is forbidden on this mailing-list. Do not do it again if you
want help. Look it up if you do not know what it means.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20210821/4cbf9d35/attachment.sig>


More information about the ffmpeg-user mailing list