---
title: "init(contentType:)"
framework: avfoundation
role: symbol
role_heading: Initializer
path: "avfoundation/avassetwriter/init(contenttype:)"
---

# init(contentType:)

Creates an object that outputs segment data in a specified container format.

## Declaration

```swift
init(contentType outputContentType: UTType)
```

## Parameters

- `outputContentType`: A type that indicates the format of the segment data to output.

## Discussion

Discussion Use this initializer to create an asset writer that outputs segment data to an adopter of the AVAssetWriterDelegate protocol. For example, you can create an asset writer object to write an MPEG-4 file as shown below: // Create a UTType for the MP4 file type. guard let contentType = UTType(AVFileType.mp4.rawValue) else { return } let assetWriter = AVAssetWriter(contentType: contentType)

## See Also

### Creating an asset writer

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