Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 13th September 2025, 00:06   #1  |  Link
jay123210599
Registered User
 
Join Date: Apr 2024
Posts: 504
Vapoursynth Frames and Keyframes

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?
jay123210599 is offline   Reply With Quote
Old 13th September 2025, 01:20   #2  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,669
Quote:
Originally Posted by jay123210599 View Post
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
poisondeathray is offline   Reply With Quote
Old 13th September 2025, 01:56   #3  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 398
you can check clip frame properties if original frame was I, P or B, if source plugin read those:
Code:
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
_Al_ is offline   Reply With Quote
Old 13th September 2025, 08:00   #4  |  Link
Selur
.
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,860
Quote:
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 might be interesting too.
Something like
Code:
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
__________________
Hybrid here in the forum, homepage, its own forum

Last edited by Selur; 13th September 2025 at 08:02.
Selur is offline   Reply With Quote
Reply

Tags
frames, keyframes, vapoursynth

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 19:12.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.