AutoMovie API
    Preparing search index...

    Function renderAutoMovieDrawnVideo

    • Render a drawn subject into one video: draw every frame of its clock through the draw page's function, write each as a PNG, then encode them once.

      The clock and raster are the subject's, read from the session, so the spec takes no frame format. The encoding is admitted and planned by planAutoMovieVideoEncoding before the first frame is drawn, so a clock that is not a whole number of frames or an odd raster costs no drawing. Frame i is drawn at frameTimes' second i / fps in the beauty pass through the subject's own camera, and written as <frameDir>/frame_<i>.png; frames are drawn and written one at a time, in order. The encoder then runs once with the planned arguments. When a frame supplies diagnostics, the output clock binds the sample to that frame and the audit reports coverage against the full schedule.

      Files and processes are the host's: write stores a file and encode runs FFmpeg, so the order of every step runs under a unit test. encode is handed the frame receipts and scene audit with its arguments, so they survive an encoder failure. A draw, write or encode failure rejects at once and leaves the files written so far to the host.

      Parameters

      • props: {
            audio: string | null;
            encode: (
                args: readonly string[],
                drawn: Pick<IAutoMovieDrawnVideoResult, "frames" | "diagnostics">,
            ) => Promise<void>;
            frameDir: string;
            outputPath: string;
            session: Pick<AutoMovieDrawSession, "subject" | "frame">;
            spec: Omit<IAutoMovieRenderSpec, "frameFormat">;
            write: (path: string, data: Uint8Array) => Promise<void>;
        }
        • audio: string | null

          A complete soundtrack to mux, or null for none.

        • encode: (
              args: readonly string[],
              drawn: Pick<IAutoMovieDrawnVideoResult, "frames" | "diagnostics">,
          ) => Promise<void>

          Run FFmpeg with the arguments, resolving once it succeeded. It also receives the drawn frames and scene audit, already complete, so a host can keep them when encoding fails.

        • frameDir: string

          Folder the frame files are written into.

        • outputPath: string

          The video file the encoder writes.

        • session: Pick<AutoMovieDrawSession, "subject" | "frame">

          The opened draw session of the subject.

        • spec: Omit<IAutoMovieRenderSpec, "frameFormat">

          Encoding controls; the frame format is the subject's clock and raster.

        • write: (path: string, data: Uint8Array) => Promise<void>

          Store one file whole.

      Returns Promise<IAutoMovieDrawnVideoResult>