コード例 #1
0
def edit_clip(clip, start_on_timeline, end_on_timeline, in_point_on_clip, out_point_on_clip, fps=None):
    """
    Trim or move clip. This in not available in ppro 2017, use insertClip or overwriteClip

    :param clip: (Clip)
    :param start_on_timeline: (int) Frame at which the clip should start in the sequence timeline
    :param end_on_timeline: (int) Frame at which the clip should end in the sequence timeline
    :param in_point_on_clip: (int) First frame we will see of the clip (in the clip own timeline)
    :param out_point_on_clip: (int) Last frame we will see of the clip (in the clip own timeline)
    :param out_point_on_clip: (int) Last frame we will see of the clip (in the clip own timeline)
    """
    # get clip fps if no fps given
    if fps is None:
        fps = clip.projectItem.getFootageInterpretation().frameRate  # not available in ppro 2017, use sequence.timebase
    # check length match
    if end_on_timeline - start_on_timeline != out_point_on_clip - in_point_on_clip:
        raise ValueError("Duration in timeline ({} frames) doesn't match duration of clip ({} frames)".format(end_on_timeline - start_on_timeline, out_point_on_clip - in_point_on_clip))
    # convert frame to seconds and generate Time objects (note that to properly construct a Time object we should first
    # init the object empty, then set the seconds property. Don't set the ticks property, set the seconds and the ticks
    # will be properly set, the inverse is not True
    start = pymiere.Time()
    start.seconds = start_on_timeline / fps
    end = pymiere.Time()
    end.seconds = end_on_timeline / fps
    in_point = pymiere.Time()
    in_point.seconds = in_point_on_clip / fps
    out_point = pymiere.Time()
    out_point.seconds = out_point_on_clip / fps
    clip.end = end
    clip.start = start
    clip.inPoint = in_point
    clip.outPoint = out_point
コード例 #2
0
def time_from_seconds(seconds):
    """
    Many properties need a Time object to represent time, this is an helper to create one
    :param seconds: (float) time in seconds
    :return: (pymiere.Time) preseted time object
    """
    t = pymiere.Time()
    t.seconds = seconds
    return t