Platforms to show: All Mac Windows Linux Cross-Platform

Back to AVAssetWriterInputMBS class.

AVAssetWriterInputMBS.addTrackAssociationWithTrackOfInput(input as AVAssetWriterInputMBS, trackAssociationType as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 14.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Associates the track corresponding to the specified input with the track corresponding with the receiver.

input: The instance of AVAssetWriterInput with a corresponding track to associate with track corresponding with the receiver.
trackAssociationType: The type of track association to add. Common track association types, such as AVTrackAssociationTypeTimecode are defined in Track Association Types.

If the type of association requires tracks of specific media types that don't match the media types of the inputs, or if the output file type does not support track associations, an NSInvalidArgumentException is raised.

Note: Track associations cannot be added after writing on the receiver's AVAssetWriter instance has started.
Available in OS X v10.9 and later.

AVAssetWriterInputMBS.appendSampleBuffer(sampleBuffer as CMSampleBufferMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Appends samples to the receiver.

sampleBuffer: The CMSampleBuffer to be appended.

Returns true if sampleBuffer as appended successfully, otherwise false.

The timing information in the sample buffer, considered relative to the time passed to the asset writer's startSessionAtSourceTime: will be used to determine the timing of those samples in the output file.

Do not modify sampleBuffer or its contents after you have passed it to this method.

AVAssetWriterInputMBS.canAddTrackAssociationWithTrackOfInput(input as AVAssetWriterInputMBS, trackAssociationType as string) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 14.0 ✅ Yes ❌ No ❌ No ✅ Yes All
Whether an association between the tracks corresponding to a pair of inputs is valid.

input: The instance of AVAssetWriterInput with a corresponding track to associate with track corresponding with the receiver.
trackAssociationType: The type of track association to test. Common track association types, such as AVTrackAssociationTypeTimecode are defined in Track Association Types.

Returns true if the track association can be added; otherwise false.

If the type of association requires tracks of specific media types that don't match the media types of the inputs, or if the output file type does not support track associations, returns NO.
Available in OS X v10.9 and later.

AVAssetWriterInputMBS.Constructor(MediaType as string, outputSettings as dictionary = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Initialized a new input of the specified media type to receive sample buffers for writing to the output file.

mediaType: The media type of samples that will be accepted by the input.
Media types are defined in AVMediaFormat.h.
outputSettings: The settings used for encoding the media appended to the output. Pass nil to specify that appended samples should not be re-encoded.
Audio output settings keys are defined in AVAudioSettings.h. Video output settings keys are defined in AVVideoSettings.h. Video output settings with keys from <CoreVideo/CVPixelBuffer.h> are not currently supported.

Returns an input of the specified media type initialized to receive sample buffers for writing to the output file.

Each new input accepts data for a new track of the asset writer's output file. You add an input to an asset writer using the AVAssetWriter method addInput:.

Passing nil for outputSettings instructs the input to pass through appended samples, doing no processing before they are written to the output file. This is useful if, for example, you are appending buffers that are already in a desirable compressed format. However, passthrough is currently supported only when writing to QuickTime Movie files (i.e. the AVAssetWriter was initialized with AVFileTypeQuickTimeMovie). For other file types, you must specify non-nil output settings.

See also:

AVAssetWriterInputMBS.Constructor(MediaType as string, outputSettings as dictionary, sourceFormatHint as CMFormatDescriptionMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Initialized a new input of the specified media type to receive sample buffers for writing to the output file.

See also:

AVAssetWriterInputMBS.markAsFinished

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Tells the writer that no more buffers will be appended to this input.

If you are monitoring each input's expectsMediaDataInRealTime value to keep the output file well interleaved, it is important to call this method when you have finished adding buffers to a track. This is necessary to prevent other inputs from stalling, as they may otherwise wait forever for that input's media data, attempting to complete the ideal interleaving pattern.

Some examples using this method:

AVAssetWriterInputMBS.metadata as AVMetadataItemMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The collection of track-level metadata for association with the asset and for carriage in the output file.

The array contains AVMetadataItem objects representing the collection of track-level metadata to be written in the output file.
See also setMetadata method.

AVAssetWriterInputMBS.outputSettings as dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The settings used for encoding the media appended to the output. (read-only)

A value of nil specifies that appended samples should not be re-encoded.

AVAssetWriterInputMBS.requestMediaDataWhenReadyOnQueue(assetWriterInput as AVAssetWriterInputMBS, AssetReaderOutput as AVAssetReaderOutputMBS, tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Instructs the receiver to invoke an event repeatedly, at its convenience, in order to gather media data for writing to the output.

This is a special version of that method where the plugin does the required work.
The plugin provides the block to do the work to copy samples from input to output.
You receive AVFoundationMBS.requestMediaDataWhenReadyOnQueueProgress events and on the end an AVFoundationMBS.requestMediaDataWhenReadyOnQueueFinished event, when assetReaderOutput.NextSampleBuffer does not provide the next buffer.

With tag you can pass any value you like to the event later. This can be for example an object reference or a number in an array. Be aware that the reference to this tag value is kept until the event is called and can cause memory reference cycles.

See also:

Some examples using this method:

AVAssetWriterInputMBS.requestMediaDataWhenReadyOnQueue(tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Instructs the receiver to invoke an event repeatedly, at its convenience, in order to gather media data for writing to the output.

Calls later AVFoundationMBS.requestMediaDataWhenReadyOnQueueCompleted event.

With tag you can pass any value you like to the event later. This can be for example an object reference or a number in an array. Be aware that the reference to this tag value is kept until the event is called and can cause memory reference cycles.

See also:

AVAssetWriterInputMBS.setMetadata(items() as AVMetadataItemMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the collection of track-level metadata for association with the asset and for carriage in the output file.

The array contains AVMetadataItem objects representing the collection of track-level metadata to be written in the output file.
You cannot set this property after writing on the receiver's asset writer has started.

AVAssetWriterInputMBS.sourceFormatHint as CMFormatDescriptionMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
A hint about the format of buffers that will be appended.

An AVAssetWriterInput object may be able to use this hint to fill in missing output settings or perform more upfront validation. To guarantee successful file writing, if you set this property you should ensure that subsequently-appended buffers are of the specified format. An NSInvalidArgumentException will be thrown if the media type of the format description does not match the media type of the writer input.

AVAssetWriterInputMBS.transform as CGAffineTransformMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The transform specified in the output file as the preferred transformation of the visual media data for display purposes.

If no value is specified, the identity transform is used.
(Read and Write computed property)

The items on this page are in the following plugins: MBS AVFoundation Plugin.


The biggest plugin in space...