我以后会用这个片段作为视频源来处理它:
import vapoursynth as vs
core = vs.core
core.std.LoadPlugin("/usr/local/lib/libffms2.so")
video = core.ffms2.Source("videotest.mkv")如何获得指定帧的时间戳或每个帧的时间戳列表?
发布于 2018-10-10 22:21:14
根据FFMS2和VapourSynth API-引用的文档,可以通过访问每个帧的_AbsoluteTime支柱来获得帧的时间戳。
使用video.frames()在每个帧上获得一个迭代器:
for frame in video.frames():
print(frame.props["_AbsoluteTime"])这里还有另一个例子:
>>> import vapoursynth
>>> s = vapoursynth.core.ffms2.Source(r"Z:\Anime\Serien\Incomplete\Akanesasu Shoujo\[HorribleSubs] Akanesasu Shoujo - 01 [1080p].mkv")
>>> f = s.get_frame(0)
>>> f.props
<vapoursynth.VideoProps {'_AbsoluteTime': 0.043, '_ChromaLocation': 0, '_ColorRange': 1, '_DurationDen': 1000, '_DurationNum': 41, '_FieldBased': 0, '_Matrix': 2, '_PictType': b'I', '_Primaries': 2, '_SARDen': 1, '_SARNum': 1, '_Transfer': 2}>
>>> f.props._AbsoluteTime
0.043https://stackoverflow.com/questions/52742553
复制相似问题