AVCaptureMovieFileOutput Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/AVFoundation.framework
Availability
Available in OS X v10.7 and later.
Declared in
AVCaptureOutput.h
Related sample code

Overview

AVCaptureMovieFileOutput is a concrete sub-class of AVCaptureFileOutput you use to capture data to a QuickTime movie.

The timeMapping.target.start of the first track segment must be kCMTimeZero, and the timeMapping.target.start of each subsequent track segment must equal CMTimeRangeGetEnd(<#the previous AVCompositionTrackSegment's timeMapping.target#>). You can use validateTrackSegments:error: to ensure that an array of track segments conforms to this rule.

Tasks

Movie Configuration

Managing Output Settings

Properties

metadata

The metadata for the output file.

@property(nonatomic, copy) NSArray *metadata
Discussion

The array contains AVMetadataItem objects. You use this array to add metadata such as copyright, creation date, and so on, to the recorded movie file.

Availability
  • Available in OS X v10.7 and later.
Declared In
AVCaptureOutput.h

movieFragmentInterval

Indicates the number of seconds of output that are written per fragment.

@property(nonatomic) CMTime movieFragmentInterval
Discussion

The default is 10 seconds. Set to kCMTimeInvalid to disable movie fragment writing (not typically recommended).

A QuickTime movie is comprised of media samples and a sample table identifying their location in the file. A movie file without a sample table is unreadable.

In a processed file, the sample table typically appears at the beginning of the file. It may also appear at the end of the file, in which case the header contains a pointer to the sample table at the end. When a new movie file is being recorded, it is not possible to write the sample table since the size of the file is not yet known. Instead, the table is must be written when recording is complete. If no other action is taken, this means that if the recording does not complete successfully (for example, in the event of a crash), the file data is unusable (because there is no sample table). By periodically inserting “movie fragments” into the movie file, the sample table can be built up incrementally. This means that if the file is not written completely, the movie file is still usable (up to the point where the last fragment was written).

Availability
  • Available in OS X v10.7 and later.
Declared In
AVCaptureOutput.h

Instance Methods

outputSettingsForConnection:

Returns the options the receiver uses to re-encode media from a given connection as it is being recorded.

- (NSDictionary *)outputSettingsForConnection:(AVCaptureConnection *)connection
Parameters
connection

The connection delivering the media to be re-encoded.

Return Value

A dictionary of output settings.

Discussion

If the returned value is an empty dictionary (as you would get from [NSDictionary dictionary]), the format of the media from the connection will not be changed before being written to the file.

If you invoked setOutputSettings:forConnection: with a nil dictionary, this method returns a non-nil dictionary reflecting the settings used by the capture session’s current sessionPreset.

Availability
  • Available in OS X v10.7 and later.
Declared In
AVCaptureOutput.h

setOutputSettings:forConnection:

Sets the options the receiver uses to re-encode media from the given connection as it is being recorded.

- (void)setOutputSettings:(NSDictionary *)outputSettings forConnection:(AVCaptureConnection *)connection
Parameters
outputSettings

A dictionary of output settings.

Pass an empty dictionary (as you would get from [NSDictionary dictionary]) to specify that the format of the media from the connection should not be changed before being written to the file.

Pass nil to specify that the output format should be determined by the session preset.

connection

The connection delivering the media to be re-encoded.

Discussion

See AVAudioSettings.h for audio connections or AVVideoSettings.h for video connections for more information on how to construct an output settings dictionary.

Availability
  • Available in OS X v10.7 and later.
Declared In
AVCaptureOutput.h