def extract_stream()

in mapillary_tools/ffmpeg.py [0:0]


def extract_stream(source: str, dest: str, stream_id: int) -> None:
    if not os.path.isfile(source):
        raise exceptions.MapillaryFileNotFoundError(f"Video file not found: {source}")

    cmd = [
        "-i",
        source,
        "-y",  # overwrite - potentially dangerous
        "-nostats",
        "-loglevel",
        "0",
        "-hide_banner",
        "-codec",
        "copy",
        "-map",
        f"0:{stream_id}",
        "-f",
        "rawvideo",
        dest,
    ]

    run_ffmpeg(cmd)