Example: /AVFoundation/SDAVAssetExportSessionMBS test

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/AVFoundation/SDAVAssetExportSessionMBS test


Required plugins for this example: MBS AVFoundation Plugin, MBS Util Plugin, MBS MacCG Plugin, MBS MacCF Plugin, MBS Main Plugin, MBS MacBase Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /AVFoundation/SDAVAssetExportSessionMBS test

This example is the version from Sun, 18th Jul 2020.

Project "SDAVAssetExportSessionMBS test.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control bar Inherits ProgressBar
ControlInstance bar Inherits ProgressBar
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action() bar.Value = 1000 * encoder.progress End EventHandler
End Control
EventHandler Sub Open() Dim file As FolderItem = SpecialFolder.Desktop.Child("video.mov") Dim asset As AVAssetMBS = AVAssetMBS.assetWithFile(file) encoder = New MySDAVAssetExportSessionMBS(asset) encoder.outputFileType = AVFoundationMBS.AVFileTypeMPEG4 encoder.outputFile = SpecialFolder.Desktop.Child("output.mp4") Dim CompressionProperties As New Dictionary CompressionProperties.Value(AVFoundationMBS.AVVideoAverageBitRateKey) = 6000000 CompressionProperties.Value(AVFoundationMBS.AVVideoProfileLevelKey) = AVFoundationMBS.AVVideoProfileLevelH264High40 Dim videoSettings As New Dictionary videoSettings.Value(AVFoundationMBS.AVVideoCodecKey) = AVFoundationMBS.AVVideoCodecH264 videoSettings.Value(AVFoundationMBS.AVVideoWidthKey) = 1920 videoSettings.Value(AVFoundationMBS.AVVideoHeightKey) = 1080 videoSettings.Value(AVFoundationMBS.AVVideoCompressionPropertiesKey) = CompressionProperties encoder.videoSettings = videoSettings Dim audioSettings As New Dictionary audioSettings.Value(AVFoundationMBS.AVFormatIDKey) = OSTypeFromStringMBS(AVFoundationMBS.kAudioFormatMPEG4AAC) audioSettings.Value(AVFoundationMBS.AVNumberOfChannelsKey) = 2 audioSettings.Value(AVFoundationMBS.AVSampleRateKey) = 44100 audioSettings.Value(AVFoundationMBS.AVEncoderBitRateKey) = 128000 encoder.audioSettings = audioSettings encoder.exportAsynchronously End EventHandler
Property encoder As MySDAVAssetExportSessionMBS
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class MySDAVAssetExportSessionMBS Inherits SDAVAssetExportSessionMBS
EventHandler Sub exportAsynchronouslyCompleted() If (Me.status = StatusCompleted) Then MsgBox "Video export succeeded" Elseif (Me.status = StatusCancelled) then MsgBox "Video export cancelled" Else MsgBox "Video export failed with error: " + me.error.localizedDescription end if End EventHandler
End Class
End Project

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


💬 Ask a question or report a problem