keyframe - Get keytframe from a video in python with ffms2 -


i know if possible key frames of video.

i find vapoursynth can find correct way:

you can check code

import vapoursynth vs import time import sys  import ctypes  core = vs.get_core()  # load plugin core.std.loadplugin('c:/python34/ffms2.dll')  # load video video = core.ffms2.source(source='c:/python34/video.mkv')  print(video) 

i cannot find should use, tried video.get_frame(x) nothing key frame.

frame = video.get_frame(0) is_keyframe = frame.props['_picttype'] == 'i' 

this delightfully underdocumented. _picttype value av_get_picture_type_char.

note getting frame type each frame requires decoding each frame, makes useless of places you'd want list of keyframes. ffms2 knows ones keyframes without decoding everything, isn't exposed via vapoursynth (it exposed via c api).


Comments