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 |
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.
LowQuality | Low Quality | OS X 10.11 and newer |
MediumQuality | Medium Quality | OS X 10.11 and newer |
HighestQuality | High Quality | OS 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.
640x480 | VGA Resolution, 640 x 480 Pixel | OS X 10.7 and newer |
960x540 | Half HD Resolution, 960 x 540 Pixel | OS X 10.7 and newer |
1280x720 | 720p Resolution, 1280 x 720 Pixel | OS X 10.7 and newer |
1920x1080 | Full HD Resolution, 1920 x 1080 Pixel, | OS X 10.7 and newer |
3840x2160 | 4K Resolution, 3840 x 2160 | OS 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).
AppleM4VCellular | Celluar | OS X 10.7 and newer |
AppleM4ViPod | iPod | OS X 10.7 and newer |
AppleM4V480pSD | 480p SD | OS X 10.7 and newer |
AppleM4VAppleTV | AppleTV | OS X 10.7 and newer |
AppleM4VWiFi | Wifi | OS X 10.7 and newer |
AppleM4V720pHD | 720p HD | OS X 10.7 and newer |
AppleM4V1080pHD | 1080p HD | OS 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.
Passthrough | Pass through data if possible. | OS X 10.7 and newer |
AppleM4A | Audio-only .m4a file with appropriate iTunes gapless playback data | OS X 10.7 and newer |
AppleProRes422LPCM | QuickTime 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
- AVAsset.OpenContainer
- AVAsset.OpenFile
- AVAsset.OpenURL
- AVAsset.Release
- AVExport.AllExportPresets
- AVExport.Duration
- AVExport.ExportSessionMerge
- AVExport.SetTimeRange
- AVExport.SupportedFileTypes
- Text.RemovePrefix
Release notes
- Version 8.0
- Fixed problem with AVExport.ExportSessionMerge and new example to work.
Example Databases
This function checks for a license.
Created 29th February 2016, last changed 2nd February 2022