auto-editor icon indicating copy to clipboard operation
auto-editor copied to clipboard

Make output available while rendering

Open flt6 opened this issue 2 years ago • 0 comments

Want

Make a link to the rendering video file, and render the video with the audio in spedup0.mp4. So user can watch the video real time, since encode speed is always more than 1x.

Details

Auto-editor is also useful when watching online class for students, since some teacher used to have a lot of meaningless silence in their class (I tried analysis 1 example, and found about 40% is silence.) However, I do not want to wait until all the video is rendered.

Implementation example

An simple example for implementation(haven't take some feathers into consideration, only to explain what I need Replace cmd of https://github.com/WyattBlue/auto-editor/blob/7148db67fc5279f37321931dc1032947b29aec66/auto_editor/render/video.py#L129-L146 to

  cmd = [
        "-hide_banner",
        "-y",
        "-f",
        "rawvideo",
        "-c:v",
        "rawvideo",
        "-pix_fmt",
        target_pix_fmt,
        "-s",
        f"{width}*{height}",
        "-framerate",
        f"{tl.tb}",
        "-i",
        "-",
        "-i",
        os.path.join(temp, "new0.wav"),
        "-map",
        "0:v",
        "-pix_fmt",
        target_pix_fmt,
        "-map",
        "1:a",
    ]

and replace https://github.com/WyattBlue/auto-editor/blob/7148db67fc5279f37321931dc1032947b29aec66/auto_editor/render/video.py#L127 to

spedup = os.path.join(temp, "spedup0.ts")

And you can view the video real time in the TEMP dir, with only part argument are supported. For example: auto-editor example.mp4

flt6 avatar Dec 14 '23 08:12 flt6