A capture output that records video and audio to a QuickTime movie file.


class AVCaptureMovieFileOutput : AVCaptureFileOutput


This class is the movie file equivalent of AVCapturePhotoOutput. Use it to export or save movie files from capture session content.

The of the first track segment must be zero, and the of each subsequent track segment must equal CMTimeRangeGetEnd(_:), when passing in the previous AVCompositionTrackSegment's You can use validateSegments(_:) to ensure that an array of track segments conforms to this rule.

Starting in iOS 12, photo formats no longer list the AVCaptureMovieFileOutput.class as being unsupported. If you construct a session with a photo format as input and a movie file output, you can record movies. The resolution of the video track in the movie follows the conventions established by the AVCaptureVideoDataOutput; namely, when using the photo preset, you receive video buffers with size approximating the screen size. Video outputs are a proxy for photo preview in this configuration.

If you set the AVCaptureDevice format to a high-resolution photo format, you receive full-resolution (5, 8, or 12 MP depending on the device) video buffers into your movie. If the capture session’s automaticallyConfiguresCaptureDeviceForWideColor property is true, the session selects sRGB as the video colorspace in your movie. You can override this behavior by adding an AVCapturePhotoOutput to your session and configuring its photo format or photo preset for a photo output.


Initializing Movies

Configuring Movies

var movieFragmentInterval: CMTime

The number of seconds of output that are written per fragment.

var metadata: [AVMetadataItem]?

The metadata for the output file.

Preparing Movie Capture for Open GOP

Generate independently decodable frames in the HEVC format, or opt out for older devices.

Managing Output Settings

func supportedOutputSettingsKeys(for: AVCaptureConnection) -> [String]

The list of supported keys for the output settings dictionary.

func outputSettings(for: AVCaptureConnection) -> [String : Any]

Returns the options used to reencode media from a given connection as it's being recorded.

func setOutputSettings([String : Any]?, for: AVCaptureConnection)

Sets the options dictionary used to reencode media from the given connection as it's being recorded.

var availableVideoCodecTypes: [AVVideoCodecType]

The video codec types currently supported for recording movie files.

Video Settings Dictionaries

Define output image and video formats by using the key and value constants.

struct AVVideoCodecType

A set of constants used to describe codecs for video capture.

Setting Orientation

func recordsVideoOrientationAndMirroringChangesAsMetadataTrack(for: AVCaptureConnection) -> Bool

A Boolean indicating whether the capture device records video orientation.

func setRecordsVideoOrientationAndMirroringChangesAsMetadataTrack(Bool, for: AVCaptureConnection)

A Boolean indicating whether the capture device sets video orientation.


Inherits From

Conforms To

See Also

Movie and Video Capture

Capturing Video in Alternative Formats

Change the format used for capturing movie files.

class AVCaptureVideoDataOutput

A capture output that records video and provides access to video frames for processing.