Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

AVExport.ExportSession

Creates a new export session.

Component Version macOS Windows Linux Server iOS SDK
AVExport 6.1 ✅ Yes ❌ No ❌ No ✅ Yes, on macOS ✅ Yes
MBS( "AVExport.ExportSession"; Asset; Preset )   More

Parameters

Parameter Description Example
Asset The reference number of the asset. Please use AVAsset.OpenContainer, AVAsset.OpenFile or AVAsset.OpenURL function to get asset reference. $asset
Preset The preset name to use.
Can be one of the presets returned by AVExport.AllExportPresets or one of the predefined ones:
"640x480"

Result

Returns reference number or error.

Description

Creates a new export session.
Returns a reference number for the new AVAsset export session for the specified source asset and preset.

Presets:
These export options can be used to produce movie files with video size appropriate to the device. The export will not scale the video up from a smaller size. The video will be compressed using H.264 and the audio will be compressed using AAC.

LowQualityLow QualityOS X 10.11 and newer
MediumQualityMedium QualityOS X 10.11 and newer
HighestQualityHigh QualityOS X 10.11 and newer

These export options can be used to produce movie files with the specified video size.
The export will not scale the video up from a smaller size. The video will be compressed using H.264 and the audio will be compressed using AAC. Some devices cannot support some sizes.

640x480VGA Resolution, 640 x 480 PixelOS X 10.7 and newer
960x540 Half HD Resolution, 960 x 540 PixelOS X 10.7 and newer
1280x720 720p Resolution, 1280 x 720 PixelOS X 10.7 and newer
1920x1080Full HD Resolution, 1920 x 1080 Pixel, OS X 10.7 and newer
3840x21604K Resolution, 3840 x 2160OS X 10.10 and newer

These export options are used to produce files that can be played on the specified Apple devices. These presets are available for Desktop export only. The files should have .m4v extensions (or .m4a for exports with audio only sources).

AppleM4VCellularCelluarOS X 10.7 and newer
AppleM4ViPodiPodOS X 10.7 and newer
AppleM4V480pSD480p SDOS X 10.7 and newer
AppleM4VAppleTVAppleTVOS X 10.7 and newer
AppleM4VWiFiWifiOS X 10.7 and newer
AppleM4V720pHD720p HDOS X 10.7 and newer
AppleM4V1080pHD1080p HDOS X 10.8 and newer

Passthrough export option will cause the media of all tracks to be passed through to the output exactly as stored in the source asset, except for tracks for which passthrough is not possible, usually because of constraints of the container format as indicated by the specified outputFileType. This option is not included in the arrays returned by AVExport.AllExportPresets.

PassthroughPass through data if possible.OS X 10.7 and newer
AppleM4AAudio-only .m4a file with appropriate iTunes gapless playback dataOS X 10.7 and newer
AppleProRes422LPCMQuickTime movie with Apple ProRes 422 video and LPCM audio.OS X 10.7 and newer

You can use AVExport.ExportSession to export to a new file. With AVExport.SetTimeRange you can only export a clip and with AVExport.ExportSessionMerge you can merge multiple videos to one.

Examples

Create export session:

If [not IsEmpty($$AVExport)]
    Show Custom Dialog ["We have a session already!?"]
    Exit Script []
End If
Set Variable [$Asset; Value:MBS( "AVAsset.OpenFile"; AVAsset Export Session::Input File Path )]
Set Variable [$$AVExport; Value:MBS( "AVExport.ExportSession"; $Asset; AVAsset Export Session::PresetName )]
If [MBS("IsError")]
    Set Variable [$r; Value:MBS( "AVAsset.Release"; $Asset)]
    Show Custom Dialog ["Failed to create export sessio…"; MBS("Text.RemovePrefix"; $$AVExport; "[MBS] ")]
    Exit Script []
End If
Set Variable [$r; Value:MBS( "AVAsset.Release"; $Asset)]
Set Field [AVAsset Export Session::Duration; MBS( "AVExport.Duration"; $$AVExport )]
Set Field [AVAsset Export Session::SupportedFileTypes; MBS( "AVExport.SupportedFileTypes"; $$AVExport )]

See also

Release notes

Example Databases

This function checks for a license.

Created 29th February 2016, last changed 2nd February 2022


AVExport.ExportAsynchronously - AVExport.ExportSessionMerge