コード例 #1
0
def main(io, loop):
    # Verify values of the component inputs
    if io is None:
        e = "Input parameter IO failed to collect data"
        ghenv.Component.AddRuntimeMessage(
            gh.Kernel.GH_RuntimeMessageLevel.Warning, e)
        return
    else:
        if not isinstance(io, InputOutput):
            e = "Data conversion failed from {} to I/O Information" \
                .format(type(io).__name__)
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

        ext = io.input_fname.split(".")[-1].upper()
        if ext not in VID_FORMATS:
            e = "'{}' does not have a valid file format, \n" \
                .format(io.input_fname)
            e += "currently supported formats include: \n{}" \
                .format(", ".join(sorted(VID_FORMATS)))
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    if loop is None:
        loop = 0  # default value
    else:
        if is_integer_num(loop):
            if int(float(loop)) < 0:  # fixes invalid string literal
                e = "Optional input parameter Loop must be " \
                  + "greater than or equal to 0"
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e)
                return
            else:
                loop = int(loop)
        else:
            e = "Optional input parameter Loop must be an integer"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    # Configure the settings
    st = SettingsVideoToGIF(io, loop)
    return st
コード例 #2
0
def main(io, start_num, rename):
    # Verify values of the component inputs
    if io is None:
        e = "Input parameter IO failed to collect data"
        ghenv.Component.AddRuntimeMessage(
            gh.Kernel.GH_RuntimeMessageLevel.Warning, e
        )
        return
    else:
        if not isinstance(io, InputOutput):
            e = "Data conversion failed from {} to I/O Information" \
                .format(type(io).__name__)
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e
            )
            return

    if start_num is None:
        start_num = 0  # default value
    else:
        if is_integer_num(start_num):
            if int(float(start_num)) < 0:  # fixes invalid string literal
                e = "Optional input parameter StartNumber must be greater" \
                    + " than or equal to 0"
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e
                )
                return
            else:
                start_num = int(start_num)
        else:
            e = "Optional input parameter StartNumber must be an integer"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e
            )
            return

    if rename is None:
        rename = False
    else:
        test, rename = is_bool(rename)
        if not test:
            e = "Input parameter Rename must be a boolean (i.e. True, False)," \
                + " 0 (False), or 1 (True)"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e
            )
            return

    # (Move and) rename the files
    if rename:
        try:
            io.rename_sequence_files(start_num)
        except Exception as e:
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, str(e)
            )
    else:
        if compare(io.input_dir, io.output_dir, True):
            e = "The initial files - defined by SourcePath -, are going to " \
                + "be renamed, \nsince the specified TargetFolder is equal " \
                + "to the source folder"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Warning, e
            )
コード例 #3
0
def main(io, framerate, start_frame, video_format, video_bitrate, loop):
    # Verify values of the component inputs
    if io is None:
        e = "Input parameter IO failed to collect data"
        ghenv.Component.AddRuntimeMessage(
            gh.Kernel.GH_RuntimeMessageLevel.Warning, e)
        return
    else:
        if not isinstance(io, InputOutput):
            e = "Data conversion failed from {} to I/O Information" \
                .format(type(io).__name__)
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

        ext = io.input_fname.split(".")[-1].upper()
        if ext not in SUPP_FORMATS:
            e = "'{}' does not have a valid file format, \n" \
                .format(io.input_fname)
            e += "currently supported formats include: \n{}" \
                .format(", ".join(sorted(SUPP_FORMATS)))
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    if io.im is not None and io.im.get_start_number() < 0:  # is single image
        e = "This component does not work with single images"
        ghenv.Component.AddRuntimeMessage(
            gh.Kernel.GH_RuntimeMessageLevel.Error, e)
        return

    _, in_ext = os.path.splitext(io.input_fname)
    in_ext = in_ext.strip(".").upper()
    if in_ext not in SUPP_FORMATS:
        e = "'{}' is not a valid file format, ".format(in_ext)
        e += "currently supported formats include: \n{}" \
            .format(", ".join(SUPP_FORMATS))
        ghenv.Component.AddRuntimeMessage(
            gh.Kernel.GH_RuntimeMessageLevel.Error, e)
        return

    if framerate is None:
        framerate = 30  # default value
    else:
        if is_num(framerate):
            if float(framerate) <= 0:  # fixes invalid string literal
                e = "Optional input parameter Framerate must be greater than 0"
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e)
                return
        else:
            e = "Optional input parameter Framerate must be a number"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    if start_frame is None:
        start_frame = io.im.get_start_number()
    else:
        first_frame = io.im.get_start_number()
        last_frame = first_frame + len(io.im.get_sequence_files(False)) - 1
        if is_integer_num(start_frame):
            if first_frame > int(float(start_frame)) or \
                    int(float(start_frame)) >= last_frame:
                e = "Optional input parameter StartFrame must be bigger than or "
                e += "equal to {}, or smaller than {}".format(
                    first_frame, last_frame)
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e)
                return
            start_frame = int(start_frame)
        else:
            e = "Optional input parameter StartFrame must be an integer"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    if video_format is None:
        video_format = "MP4"  # default value
    else:
        if isinstance(video_format, str) and not is_integer_num(video_format):
            vformat = video_format.strip().upper().replace(".", "")
            if vformat not in VID_FORMATS:
                e = "{} is not a valid video format, ".format(video_format)
                e += "currently available formats include: {}" \
                    .format(", ".join(VID_FORMATS))
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e)
                return
            video_format = vformat
        elif is_integer_num(video_format):
            idx = int(float(video_format))
            if idx < 0 or idx >= len(VID_FORMATS):
                options = [
                    "{}: {}".format(i, fmt)
                    for i, fmt in enumerate(VID_FORMATS)
                ]
                e = "{} is not a valid a video format, ".format(idx)
                e += "currently available formats include: {}" \
                    .format(", ".join(options))
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e)
                return
            video_format = VID_FORMATS[idx]
        else:
            e = "Optional input parameter VideoFormat must be a string, " \
                + "representing a video file extension, or an integer " \
                + "number from 0 to {}".format(len(VID_FORMATS) - 1)
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    if video_bitrate is None:
        video_bitrate = 5.0  # default megabytes value
    else:
        if is_num(video_bitrate):
            if float(video_bitrate) < 0.1 or float(video_bitrate) > 12.0:
                e = "Optional input parameter VideoBitrate must be greater " \
                    + "than or equal to 0.1, and less than or equal to 12.0"
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e)
                return
            else:
                # Convert from megabytes to octets and round to closest integer
                video_bitrate = float(video_bitrate)
        else:
            e = "Optional input parameter VideoBitrate must be a number " \
                + "greater than or equal to 0.1, and less than or equal to 12.0"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    if loop is None:
        loop = 0  # default value
    else:
        if is_integer_num(loop):
            if int(float(loop)) < 0:  # fixes invalid string literal
                e = "Optional input parameter Loop must be greater than " \
                    + "or equal to 0"
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e)
                return
            elif int(float(loop)) >= 15:  # excessive loop count message
                msg = "Setting an excessively high loop count for videos " \
                      + "can lead to huge file sizes and crash Rhino, " \
                      + "while FFmpeg keeps running in the background"
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Remark, msg)
            else:
                loop = int(loop)
        else:
            e = "Optional input parameter Loop must be an integer"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    # Configure the settings
    st = SettingsFramesToVideo(io, framerate, start_frame, video_format,
                               video_bitrate, loop)

    return st
コード例 #4
0
def main(io, image_format, start_frame, padding, framerate, sub_dirname):
    # Verify values of the component inputs
    if io is None:
        e = "Input parameter IO failed to collect data"
        ghenv.Component.AddRuntimeMessage(
            gh.Kernel.GH_RuntimeMessageLevel.Warning, e)
        return

    ext = io.input_fname.split(".")[-1].upper()
    if ext not in SUPP_IN_FORMATS:
        e = "{} is not a valid format for this setting component.\n " \
            .format(ext)
        e += "'SourcePath' input from the I/O component must refer to " + \
             "one of the following currently available formats:\n"
        e += "{}".format(", ".join(SUPP_IN_FORMATS))
        ghenv.Component.AddRuntimeMessage(
            gh.Kernel.GH_RuntimeMessageLevel.Error, e)
        return
    else:
        if not isinstance(io, InputOutput):
            e = "Data conversion failed from {} to I/O Information" \
              .format(type(io).__name__)
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    if image_format is None:
        image_format = "PNG"  # default value
    else:
        if isinstance(image_format, str) and not is_integer_num(image_format):
            iformat = image_format.strip().upper().replace(".", "")
            if iformat not in SUPP_OUT_FORMATS:
                e = "'{}' is not a valid image format, ".format(image_format)
                e += "currently available formats include: {}" \
                    .format(", ".join(SUPP_OUT_FORMATS))
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e)
                return
            image_format = iformat
        elif is_integer_num(image_format):
            idx = int(float(image_format))
            if idx < 0 or idx >= len(SUPP_OUT_FORMATS):
                options = [
                    "{}: {}".format(i, fmt)
                    for i, fmt in enumerate(SUPP_OUT_FORMATS)
                ]
                e = "{} is not a valid a image format choice, ".format(idx)
                e += "currently available choices include: {}" \
                    .format(", ".join(options))
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e)
                return
            image_format = SUPP_OUT_FORMATS[idx]
        else:
            e = "Optional input parameter ImageFormat must be a string, " \
                + "representing a image file extension, or an integer number " \
                + "from 0 to {}".format(len(SUPP_OUT_FORMATS)-1)
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    if start_frame is None:
        start_frame = 0  # default value
    else:
        if is_integer_num(start_frame):
            if int(float(start_frame)) < 0:  # fixes invalid string literal
                e = "Optional input parameter StartFrame must be greater " \
                    + "than or equal to 0"
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e)
                return
            else:
                start_frame = int(start_frame)
        else:
            e = "Optional input parameter StartFrame must be an integer"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    if padding is None or 0 <= padding <= 1:
        num_pattern = "%d"  # default value (also for 0 and 1)
    else:
        if is_integer_num(padding):
            if int(float(padding)) < 1:  # fixes invalid string literal
                e = "Optional input parameter Padding must be greater than " \
                    + "or equal to 0"
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e)
                return
            else:  # custom padding
                e = "Use custom zero padding cautiously! \nAn insufficient " + \
                    "number of padded zeros for the total number of \n" + \
                    "frames to export, may produce unequal padding results."
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Warning, e)

                num_pattern = "%d"  # str(0) and str(1)
                if int(padding) > 1:
                    num_pattern = "%0{}d".format(int(padding))

        else:
            e = "Optional input parameter Padding must be an integer"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    if not isinstance(sub_dirname, str):
        if sub_dirname is not None:  # default value
            e = "Input parameter TargetSubfolder must be a string"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    if framerate is not None:
        if not is_num(framerate) or framerate <= 0:
            e = "Input parameter Framerate must be a number larger than 0"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    # Configure the settings
    st = SettingsVidGIFToFrames(io, image_format, start_frame, num_pattern,
                                framerate, sub_dirname)

    return st
コード例 #5
0
def main(io, framerate, start_frame, loop):
    # Verify values of the component inputs
    if io is None:
        e = "Input parameter IO failed to collect data"
        ghenv.Component.AddRuntimeMessage(
            gh.Kernel.GH_RuntimeMessageLevel.Warning, e
        )
        return

    else:
        if not isinstance(io, InputOutput):
            e = "Data conversion failed from {} to I/O Information" \
                .format(type(io).__name__)
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e
            )
            return

        ext = io.input_fname.split(".")[-1].upper()
        if ext not in SUPP_FORMATS:
            e = "'{}' does not have a valid file format, \n" \
                .format(io.input_fname)
            e += "currently supported formats include: \n{}" \
                .format(", ".join(sorted(SUPP_FORMATS)))
            ghenv.Component.AddRuntimeMessage(
            gh.Kernel.GH_RuntimeMessageLevel.Error, e
            )
            return

    if io.im is not None and io.im.get_start_number() < 0:  # is single image
        e = "This component does not work with single images"
        ghenv.Component.AddRuntimeMessage(
            gh.Kernel.GH_RuntimeMessageLevel.Error, e
        )
        return

    if framerate is None:
        framerate = 30  # default value
    else:
        if is_num(framerate):
            if float(framerate) <= 0:  # fixes invalid string literal
                e = "Optional input parameter Framerate must be greater than 0"
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e
                )
                return
        else:
            e = "Optional input parameter Framerate must be a number"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e
            )
            return

    if start_frame is None:
        start_frame = io.im.get_start_number()
    else:
        first_frame = io.im.get_start_number()
        last_frame = first_frame + len(io.im.get_sequence_files(False)) - 1
        if is_integer_num(start_frame):
            if first_frame > int(float(start_frame)) or \
                    int(float(start_frame)) >= last_frame:
                e = "Optional input parameter StartFrame must be bigger than or "
                e += "equal to {}, or smaller than {}".format(first_frame, last_frame)
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e
                )
                return
            start_frame = int(start_frame)
        else:
            e = "Optional input parameter StartFrame must be an integer"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e
            )
            return

    if loop is None:
        loop = 0  # default value
    else:
        if is_integer_num(loop):
            if int(float(loop)) < 0:  # fixes invalid string literal
                e = "Optional input parameter Loop must be " \
                    + "greater than or equal to 0"
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e
                )
                return
            else:
                loop = int(loop)
        else:
            e = "Optional input parameter Loop must be an integer"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e
            )
            return

    # Configure the settings
    st = SettingsFramesToGIF(io, framerate, start_frame, loop)
    return st
コード例 #6
0
def main(io, image_format, sub_dirname):
    # Verify values of the component inputs
    if io is None:
        e = "Input parameter IO failed to collect data"
        ghenv.Component.AddRuntimeMessage(
            gh.Kernel.GH_RuntimeMessageLevel.Warning, e)
        return

    else:
        if not isinstance(io, InputOutput):
            e = "Data conversion failed from {} to I/O Information" \
                .format(type(io).__name__)
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

        ext = io.input_fname.split(".")[-1].upper()
        if ext not in SUPP_FORMATS:
            e = "'{}' does not have a valid file format, \n" \
                .format(io.input_fname)
            e += "currently supported formats include: \n{}" \
                .format(", ".join(sorted(SUPP_FORMATS)))
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    if image_format is None:
        w = "Input parameter Format failed to collect data"
        ghenv.Component.AddRuntimeMessage(
            gh.Kernel.GH_RuntimeMessageLevel.Warning, w)
        return
    else:
        if isinstance(image_format, str) and not is_integer_num(image_format):
            ext = image_format.strip().upper().replace(".", "")
            if ext not in SUPP_FORMATS:
                e = "'{}' is not a valid image format, ".format(image_format)
                e += "currently available formats include: {}" \
                    .format(", ".join(SUPP_FORMATS))
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e)
                return

            image_format = ext

        elif is_integer_num(image_format):
            idx = int(float(image_format))
            if idx < 0 or idx >= len(SUPP_FORMATS):
                options = [
                    "{}: {}".format(i, fmt)
                    for i, fmt in enumerate(SUPP_FORMATS)
                ]
                e = "{} is not a valid a image format choice, ".format(idx)
                e += "currently available formats include: {}" \
                    .format(", ".join(options))
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e)
                return

            image_format = SUPP_FORMATS[idx]

        else:
            e = "Optional input parameter ImageFormat must be a string, " \
                + "representing a image file extension, or an integer number " \
                + "from 0 to {}".format(len(SUPP_FORMATS) - 1)
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    # Desired file format is the same as the original format
    if image_format == io.input_fname.split(".")[-1].upper():
        e = "'{}' is already a {}.\n ".format(io.input_fname, image_format)
        e += "Unable to convert to the same file format."
        ghenv.Component.AddRuntimeMessage(
            gh.Kernel.GH_RuntimeMessageLevel.Error, e)
        return

    if not isinstance(sub_dirname, str):
        if sub_dirname is not None:  # default value
            e = "Input parameter TargetSubfolder must be a string"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    # Configure the settings
    st = SettingsFramesToFrames(io, image_format, sub_dirname)
    return st
コード例 #7
0
def main(io, video_format, video_bitrate, loop):
    # Verify values of the component inputs
    if io is None:
        e = "Input parameter IO failed to collect data"
        ghenv.Component.AddRuntimeMessage(
            gh.Kernel.GH_RuntimeMessageLevel.Warning, e)
        return
    else:
        if not isinstance(io, InputOutput):
            e = "Data conversion failed from {} to I/O Information" \
                .format(type(io).__name__)
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

        ext = io.input_fname.split(".")[-1].upper()
        if ext != "GIF":
            e = "'{}' does not have a valid file format, \n" \
                .format(io.input_fname)
            e += "currently supported formats include: GIF"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    if video_format is None:
        video_format = "MP4"  # default value
    else:
        if isinstance(video_format, str) and not is_integer_num(video_format):
            vformat = video_format.strip().upper().replace(".", "")
            if vformat not in VID_FORMATS:
                e = "'{}' is not a valid video format, ".format(video_format)
                e += "currently available formats include: {}" \
                    .format(", ".join(VID_FORMATS))
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e)
                return
            video_format = vformat

        elif is_integer_num(video_format):
            idx = int(float(video_format))
            if idx < 0 or idx >= len(VID_FORMATS):
                options = [
                    "{}: {}".format(i, fmt)
                    for i, fmt in enumerate(VID_FORMATS)
                ]
                e = "{} is not a valid a video format choice, ".format(idx)
                e += "currently available choices include: {}" \
                    .format(", ".join(options))
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e)
                return
            video_format = VID_FORMATS[idx]

        else:
            e = "Optional input parameter VideoFormat must be a string, " \
                + "representing a video file extension, or an integer number " \
                + "from 0 to {}".format(len(VID_FORMATS) - 1)
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    if video_bitrate is None:
        video_bitrate = 5.0  # default megabytes value
    else:
        if is_num(video_bitrate):
            if float(video_bitrate) < 0.1 or float(video_bitrate) > 15.0:
                e = "Optional input parameter VideoBitrate must be greater " \
                    + "than or equal to 0.1, and less than or equal to 15.0"
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e)
                return
            else:
                # Convert from megabytes to octets and round to closest integer
                video_bitrate = float(video_bitrate)
        else:
            e = "Optional input parameter Bitrate must be a number greater " \
                + "than or equal to 0.1, and less than or equal to 15.0"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    if loop is None:
        loop = 1  # default value
    else:
        if is_integer_num(loop):
            if int(float(loop)) < 1:  # fixes invalid string literal
                e = "Optional input parameter Loop must be greater than " \
                    + "or equal to 1"
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Error, e)
                return
            elif int(float(loop)) >= 15:  # excessive loop count message
                msg = "Setting an excessively high loop count for videos " \
                      + "can lead to huge file sizes and crash Rhino, " \
                      + "while FFmpeg keeps running in the background"
                ghenv.Component.AddRuntimeMessage(
                    gh.Kernel.GH_RuntimeMessageLevel.Remark, msg)
            else:
                loop = int(loop)
        else:
            e = "Optional input parameter Loop must be an integer"
            ghenv.Component.AddRuntimeMessage(
                gh.Kernel.GH_RuntimeMessageLevel.Error, e)
            return

    # Configure the settings
    st = SettingsGIFToVideo(io, video_format, video_bitrate, loop)
    return st