<!--
{
  "availability" : [
    "iOS: 4.1.0 -",
    "iPadOS: 4.1.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVAssetWriter/init(outputURL:fileType:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVAssetWriter(im)initWithURL:fileType:error:"
  },
  "title" : "init(outputURL:fileType:)"
}
-->

# init(outputURL:fileType:)

Creates an object that writes media data to a container file at the output URL.

```
init(outputURL: URL, fileType outputFileType: AVFileType) throws
```

## Parameters

`outputURL`

The location of the file to write.

`outputFileType`

The type of container file to write.

## Discussion

Writing fails if a file already exists at the output URL.

---

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)