Capítulo 135 de 988

Chapter 135: combineChunks()

Core Idea

Combine multiple video or audio chunks into a single output file. This function is useful for decentralized rendering workflows where different parts of a video are rendered separately and need to be combined.

Key Concepts

  • Example
  • Arguments
  • outputLocation
  • videoFiles
  • audioFiles
  • codec
  • fps
  • framesPerChunk

Code Examples

// Video files rendered as separate chunks
const videoFiles = ['/path/to/chunk1.mp4', '/path/to/chunk2.mp4', '/path/to/chunk3.mp4'];

// Optional audio files corresponding to each video chunk
const audioFiles = ['/path/to/chunk1.aac', '/path/to/chunk2.aac', '/path/to/chunk3.aac'];

await combineChunks({
  outputLocation: '/path/to/final-video.mp4',
  videoFiles,
  audioFiles,
  codec: 'h264',
  fps: 30,
  framesPerChunk: 100,
  audioCodec: 'aac',
  preferLossless: false,
  compositionDurationInFrames: 300,
});
  • What it demonstrates: Usage pattern for combineChunks() from the official docs.

Key Takeaways

  1. Understand example when working with combineChunks().
  2. Understand arguments when working with combineChunks().
  3. Understand outputlocation when working with combineChunks().
  4. Understand videofiles when working with combineChunks().
  5. Understand audiofiles when working with combineChunks().

Connects To

  • Chromium Flags: related page in the Rendering & SSR section.
  • Compare ssr: related page in the Rendering & SSR section.
  • Dataset Render: related page in the Rendering & SSR section.