为什么我在尝试使用 ffmpeg 分割视频时会得到额外的帧

Why do I get extra frames when trying to split a video using ffmpeg

我应该得到 55912 帧,但我得到了额外的 3 帧。我应该对我的代码进行哪些更改才能解决此问题?

The video file is 18fps (00:37:16.12). Maybe its because of that extra 0.60s?

有没有办法将时间限制设置为 37:16.12 而不是 37:16.60?

代码

import os
os.system('ffmpeg -i ../source/vid.mp4 -vsync 0 -vf -an fps=25 ../frames/frame%d.png')

输出

Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf59.2.102
  Stream #0:0(und): Video: png, rgb24(pc, progressive), 320x240, q=2-31, 200 kb/s, 25 fps, 25 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.1.101 png
frame=55915 fps=679 q=-0.0 Lsize=N/A time=00:37:16.60 bitrate=N/A speed=27.1x
video:5543830kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Is there a way to set time limit to 37:16.12 instead of 37:16.60?

如果视频时间=00:37:16.60

-ss开始视频复制的时间hh:mm:ss.ms格式 -t复制视频的时间,以秒为单位(37:16.12为2236.12秒)

ffmpeg -ss 00:00:00 -i ../source/vid.mp4 -t 2236.12 -c copy new_video.mp4

观察

  • 改变fps=25 for -r 25 first.

  • -vf或视频滤镜为空,移除。

ffmpeg -i ../source/vid.mp4 -r 25 -vsync 0 -an ../frames/frame%d.png

国王问候