in03 / proxima

Transcode source media directly from DaVinci Resolve using multiple machines for encoding. Great for creating proxies quickly.
MIT License
53 stars 3 forks source link

Format this better #217

Closed github-actions[bot] closed 2 years ago

github-actions[bot] commented 2 years ago

Format this better

It's hard to format this. Every arg behind the -vf flag

should be separated by a literal comma and NO SPACES to string them together as per ffmpeg syntax.

Any optional args must provide their own literal commas so as not to leave them stray

if disabled... Inline functions here are also confusing and "magical".

But we don't want to run them queuer side, only on final queueables.

VIDEO FILTERS

https://github.com/in03/proxima/blob/a193f6bc5805d40ece8ab0508106f33d81f22ad7/proxima/worker/tasks/encode/tasks.py#L78


    ps = job["proxy_settings"]

    ffmpeg_command = [
        # INPUT
        "ffmpeg",
        "-y",  # Never prompt!
        *ps["misc_args"],
        "-i",
        job["file_path"],
        # VIDEO
        "-c:v",
        ps["codec"],
        "-profile:v",
        ps["profile"],
        "-vsync",
        "-1",  # Necessary to match VFR
        # TODO: Format this better
        # It's hard to format this. Every arg behind the -vf flag
        # should be separated by a literal comma and NO SPACES to string them together as per ffmpeg syntax.
        # Any optional args must provide their own literal commas so as not to leave them stray
        # if disabled... Inline functions here are also confusing and "magical".
        # But we don't want to run them queuer side, only on final queueables.
        # labels: enhancement
        # VIDEO FILTERS
        "-vf",
        f"scale=-2:{int(job['proxy_settings']['vertical_res'])},"
        f"scale={utils.get_input_level(job)}:out_range=limited, "
        f"{utils.get_flip(job)}"
        f"format={ps['pix_fmt']}"
        if ps["pix_fmt"]
        else "",
        # AUDIO
        "-c:a",
        ps["audio_codec"],
        "-ar",
        ps["audio_samplerate"],
        # TIMECODE
        "-timecode",
        job["start_tc"],
        # FLAGS
        "-movflags",
        "+write_colr",
        # OUTPUT
        output_path,
    ]

146b50d72246603971e673608ecf18ecafa51164

in03 commented 2 years ago

Merged this into #233