View Full Version : Vapoursynth Frames and Keyframes
jay123210599
13th September 2025, 00:06
Whenever I put a video in a vapoursynth script, all the frames become keyframes. How do I keep the default frames and keyframes from the original videos in scripts?
poisondeathray
13th September 2025, 01:20
Whenever I put a video in a vapoursynth script, all the frames become keyframes. How do I keep the default frames and keyframes from the original videos in scripts?
You can't , because video is decoded to uncompressed data when you use scripts
_Al_
13th September 2025, 01:56
you can check clip frame properties if original frame was I, P or B, if source plugin read those:
n=234
frame_type = clip.get_frame(n).props.get("_PictType")
if frame_type is not None:
print(f'frame number: {n}, frame type: {frame_type.decode("utf-8")}')
>>>frame number: 234, frame type: I
Selur
13th September 2025, 08:00
How do I keep the default frames and keyframes from the original videos in scripts?
The distinction between the frames is just a 'flag' after decoding.
ClipInfo (https://www.vapoursynth.com/doc/functions/video/text/clipinfo.html) might be interesting too.
Something like
src = core.bs.VideoSource(source="G:/TestClips&Co/files/test.avi")
def show_frame_type(n, f):
# read the pict type prop, handling both bytes and str
frame_type = f.props.get("_PictType")
if isinstance(frame_type, bytes):
frame_type = frame_type.decode("utf-8")
if frame_type is None:
frame_type = "unknown"
txt = f"Frame: {n} | Type: {frame_type}"
return core.text.Text(src, text=txt)
# FrameEval expects you to return a clip; prop_src gives you 'f' in the callback
clip = core.std.FrameEval(src, eval=show_frame_type, prop_src=src)
works fine. Important: 'clip = core.std.FrameEval(src, eval=show_frame_type, prop_src=src)' input and output need to be different variables.
Cu Selur
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.