---
title: preferredMediaChunkSize
framework: avfoundation
role: symbol
role_heading: Instance Property
path: avfoundation/avmutablemovietrack/preferredmediachunksize
---

# preferredMediaChunkSize

The maximum size to use for each chunk of sample data written to the file for file types that support media chunk duration.

## Declaration

```swift
var preferredMediaChunkSize: Int { get set }
```

## Discussion

Discussion The total size of the samples in a chunk can be no greater than the preferred chunk size, or the size of a single sample if the single sample’s size is greater than the preferred chunk size. The default media chunk duration is 1024 * 1024 bytes. Setting a negative value for the chunk duration will cause an error. A larger chunk size can result in fewer reads from the storage container, at the potential expense of a larger memory footprint.

## See Also

### Accessing media chunks

- [preferredMediaChunkAlignment](avfoundation/avmutablemovietrack/preferredmediachunkalignment.md)
- [preferredMediaChunkDuration](avfoundation/avmutablemovietrack/preferredmediachunkduration.md)
