---
title: "init(outputURL:fileType:)"
framework: avfoundation
role: symbol
role_heading: Initializer
path: "avfoundation/avassetwriter/init(outputurl:filetype:)"
---

# init(outputURL:fileType:)

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

## Declaration

```swift
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

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

## See Also

### Creating an asset writer

- [init(url:fileType:)](avfoundation/avassetwriter/init(url:filetype:)-xt34.md)
- [init(contentType:)](avfoundation/avassetwriter/init(contenttype:).md)
