{"id":21245589,"url":"https://github.com/videoflint/viexportsession","last_synced_at":"2025-07-10T22:31:14.233Z","repository":{"id":56925622,"uuid":"142646275","full_name":"VideoFlint/VIExportSession","owner":"VideoFlint","description":"A AVAssetExportSession drop-in replacement with customizable audio\u0026video settings.","archived":false,"fork":false,"pushed_at":"2019-02-23T09:23:18.000Z","size":20,"stargazers_count":45,"open_issues_count":3,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-28T11:49:40.444Z","etag":null,"topics":["avfoundation","exporter","exportsession"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VideoFlint.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-28T04:21:37.000Z","updated_at":"2024-03-26T16:43:48.000Z","dependencies_parsed_at":"2022-08-20T22:50:31.702Z","dependency_job_id":null,"html_url":"https://github.com/VideoFlint/VIExportSession","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VideoFlint%2FVIExportSession","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VideoFlint%2FVIExportSession/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VideoFlint%2FVIExportSession/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VideoFlint%2FVIExportSession/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VideoFlint","download_url":"https://codeload.github.com/VideoFlint/VIExportSession/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225658539,"owners_count":17503663,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["avfoundation","exporter","exportsession"],"created_at":"2024-11-21T01:55:58.493Z","updated_at":"2024-11-21T01:55:59.083Z","avatar_url":"https://github.com/VideoFlint.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VIExportSession\n\nA `AVAssetExportSession` drop-in replacement with customizable audio\u0026video settings.\n\nYou can get more control on video encode and decode, see the detail on `ExportConfiguration.swift`\n\n```Swift\nclass ExportConfiguration {\n    var outputURL = URL.temporaryExportURL()\n    var fileType: AVFileType = .mp4\n    var shouldOptimizeForNetworkUse = false\n    var metadata: [AVMetadataItem] = []\n}\n\nclass VideoConfiguration {\n    // Video settings see AVVideoSettings.h\n    var videoInputSetting: [String: Any]?\n    var videoOutputSetting: [String: Any]?\n    var videoComposition: AVVideoComposition?\n}\n\nclass AudioConfiguration {\n    // Audio settings see AVAudioSettings.h\n    var audioInputSetting: [String: Any]?\n    var audioOutputSetting: [String: Any]?\n    var audioMix: AVAudioMix?\n    var audioTimePitchAlgorithm: AVAudioTimePitchAlgorithm?\n}\n```\n\n## Example\n\n```\nexportSession.videoConfiguration.videoOutputSetting = {\n    let frameRate = 30\n    let bitrate = min(2000000, videoTrack.estimatedDataRate)\n    let trackDimensions = videoTrack.naturalSize\n    let compressionSettings: [String: Any] = [\n        AVVideoAverageNonDroppableFrameRateKey: frameRate,\n        AVVideoAverageBitRateKey: bitrate,\n        AVVideoMaxKeyFrameIntervalKey: 30,\n        AVVideoProfileLevelKey: AVVideoProfileLevelH264HighAutoLevel\n    ]\n    var videoSettings: [String : Any] = [\n        AVVideoWidthKey: trackDimensions.width,\n        AVVideoHeightKey: trackDimensions.height,\n        AVVideoCompressionPropertiesKey: compressionSettings\n    ]\n    if #available(iOS 11.0, *) {\n        videoSettings[AVVideoCodecKey] =  AVVideoCodecType.h264\n    } else {\n        videoSettings[AVVideoCodecKey] =  AVVideoCodecH264\n    }\n    return videoSettings\n}()\n\nexportSession.audioConfiguration.audioOutputSetting = {\n    var stereoChannelLayout = AudioChannelLayout()\n    memset(\u0026stereoChannelLayout, 0, MemoryLayout\u003cAudioChannelLayout\u003e.size)\n    stereoChannelLayout.mChannelLayoutTag = kAudioChannelLayoutTag_Stereo\n    \n    let channelLayoutAsData = Data(bytes: \u0026stereoChannelLayout, count: MemoryLayout\u003cAudioChannelLayout\u003e.size)\n    let compressionAudioSettings: [String: Any] = [\n        AVFormatIDKey: kAudioFormatMPEG4AAC,\n        AVEncoderBitRateKey: 128000,\n        AVSampleRateKey: 44100,\n        AVChannelLayoutKey: channelLayoutAsData,\n        AVNumberOfChannelsKey: 2\n    ]\n    return compressionAudioSettings\n}()\n```\n\n## Installation\n\n`VIExportSession` only support Swift 4\n\n**Cocoapods**\n\n```\nplatform :ios, '8.0'\nuse_frameworks!\n\ntarget 'MyApp' do\n  # your other pod\n  # ...\n  pod 'VIExportSession'\nend\n```\n\n**Manually**\n\nYou can simplely drag `VIExportSession.swift` to you project\n\n## LICENSE\n\nUnder MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvideoflint%2Fviexportsession","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvideoflint%2Fviexportsession","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvideoflint%2Fviexportsession/lists"}