<!--
{
  "availability" : [
    "ProVideo Encoder Extensions: 1.0.0 -",
    "macOS: 10.10.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "professional_video_applications",
  "identifier" : "/documentation/professional_video_applications/CompressorExtensionEncoder/mergeSegments(_:andAudio:toFile:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Professional Video Applications"
    ],
    "preciseIdentifier" : "c:objc(pl)CompressorExtensionEncoder(im)mergeSegments:andAudio:toFile:"
  },
  "title" : "mergeSegments(_:andAudio:toFile:)"
}
-->

# mergeSegments(_:andAudio:toFile:)

Merges multiple encoded video segments with an encoded audio segment.

```
func mergeSegments(_ videoSegments: [Any]!, andAudio audioSegment: URL!, toFile file: URL!)
```

## Parameters

`videoSegments`

An array of encoded video segment URLs.

`audioSegment`

An encoded audio segment URL.

`file`

The destination file URL at which to place the merged segments.

## Discussion

During a distributed encoding process, the encoder extension processes audio and video segments separately on the available encoder instances. Once the encoding job completes, the Compressor app invokes [`mergeSegments(_:andAudio:toFile:)`](/documentation/professional_video_applications/CompressorExtensionEncoder/mergeSegments(_:andAudio:toFile:)): on one of the encoder instances with an audio segment URL, a list of video segment URLs, and the desired output file URL. Implement this method to merge multiple encoded video segments in order, with a complete audio segment, into a single output file.

Install an encoder extension on each node of the cluster that is participating in the encoding process.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)