def METHOD_NAME() -> None:
    """Main function."""
    args = parse_args()
    dataset = load(args.input, args.nproc)
    frames, config = dataset.frames, dataset.config
    if args.config is not None:
        config = load_label_config(args.config)
    if config is None:
        raise ValueError(
            "Dataset config is not specified. Please use --config"
            " to specify a config for this dataset."
        )
    frames = seg_to_rles(frames, config, args.nproc)
    if args.per_video:
        frames_list = group_and_sort(frames)
        os.makedirs(args.output, exist_ok=True)
        for video_anns in frames_list:
            video_name = video_anns[0].videoName
            out_path = os.path.join(args.output, f"{video_name}.json")
            save(out_path, video_anns)
    else:
        save(args.output, frames)
    logger.info("Finished!")