{"id":13467412,"url":"https://github.com/NextLevel/NextLevelSessionExporter","last_synced_at":"2025-03-26T02:31:23.678Z","repository":{"id":11609944,"uuid":"67142306","full_name":"NextLevel/NextLevelSessionExporter","owner":"NextLevel","description":"🔄 Export and transcode media in Swift","archived":false,"fork":false,"pushed_at":"2024-01-27T04:24:27.000Z","size":356,"stargazers_count":264,"open_issues_count":20,"forks_count":50,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-03-21T13:51:26.162Z","etag":null,"topics":["audio","avfoundation","ios","nextlevel","swift","transcode-media","transcoder","video"],"latest_commit_sha":null,"homepage":"http://nextlevel.engineering","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/NextLevel.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-09-01T15:14:01.000Z","updated_at":"2025-01-30T08:06:36.000Z","dependencies_parsed_at":"2024-01-27T05:26:05.699Z","dependency_job_id":"cbd5c1d4-78fc-42d6-9b95-30f5b9b1f9c2","html_url":"https://github.com/NextLevel/NextLevelSessionExporter","commit_stats":{"total_commits":128,"total_committers":9,"mean_commits":"14.222222222222221","dds":0.21875,"last_synced_commit":"218de95462b02146f1c5f0dfe995f857e29e83d9"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NextLevel%2FNextLevelSessionExporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NextLevel%2FNextLevelSessionExporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NextLevel%2FNextLevelSessionExporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NextLevel%2FNextLevelSessionExporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NextLevel","download_url":"https://codeload.github.com/NextLevel/NextLevelSessionExporter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245576529,"owners_count":20638125,"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":["audio","avfoundation","ios","nextlevel","swift","transcode-media","transcoder","video"],"created_at":"2024-07-31T15:00:56.072Z","updated_at":"2025-03-26T02:31:23.032Z","avatar_url":"https://github.com/NextLevel.png","language":"Swift","readme":"\n## NextLevelSessionExporter 🔄\n\n`NextLevelSessionExporter` is an export and transcode media library for iOS written in [Swift](https://developer.apple.com/swift/).\n\n[![Build Status](https://travis-ci.org/NextLevel/NextLevelSessionExporter.svg?branch=master)](https://travis-ci.org/NextLevel/NextLevelSessionExporter) [![Pod Version](https://img.shields.io/cocoapods/v/NextLevelSessionExporter.svg?style=flat)](http://cocoadocs.org/docsets/NextLevelSessionExporter/) [![Swift Version](https://img.shields.io/badge/language-swift%205.0-brightgreen.svg)](https://developer.apple.com/swift) [![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://github.com/NextLevel/NextLevelSessionExporter/blob/master/LICENSE)\n\nThe library provides customizable audio and video encoding options unlike `AVAssetExportSession` and without having to learn the intricacies of AVFoundation. It was a port of [SDAVAssetExportSession](https://github.com/rs/SDAVAssetExportSession) with inspiration from [SCAssetExportSession](https://github.com/rFlex/SCRecorder/blob/master/Library/Sources/SCAssetExportSession.h) – which are great obj-c alternatives.\n\n- Looking for a capture library? Check out [NextLevel](https://github.com/NextLevel/NextLevel).\n- Looking for a video player? Check out [Player](https://github.com/piemonte/player)\n\nNeed a different version of Swift?\n* `5.0` - Target your Podfile to the latest release or master\n* `4.2` - Target your Podfile to the `swift4.2` branch\n* `4.0` - Target your Podfile to the `swift4.0` branch\n\n## Quick Start\n\n```ruby\n\n# CocoaPods\n\npod \"NextLevelSessionExporter\", \"~\u003e 0.4.5\"\n\n# Carthage\n\ngithub \"nextlevel/NextLevelSessionExporter\" ~\u003e 0.4.5\n\n# Swift PM\n\nlet package = Package(\n    dependencies: [\n        .Package(url: \"https://github.com/nextlevel/NextLevelSessionExporter\", majorVersion: 0)\n    ]\n)\n\n```\n\nAlternatively, drop the [source files](https://github.com/NextLevel/NextLevelSessionExporter/tree/master/Sources) into your Xcode project.\n\n## Example\n\nSimply use the `AVAsset` extension or create and use an instance of `NextLevelSessionExporter` directly.\n\n```Swift\nlet tmpURL = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)\n    .appendingPathComponent(ProcessInfo().globallyUniqueString)\n    .appendingPathExtension(\"mp4\")\nexporter.outputURL = tmpURL\n\nlet compressionDict: [String: Any] = [\n    AVVideoAverageBitRateKey: NSNumber(integerLiteral: 6000000),\n    AVVideoProfileLevelKey: AVVideoProfileLevelH264HighAutoLevel as String,\n]\nlet videoOutputConfig = [\n    AVVideoCodecKey: AVVideoCodec.h264,\n    AVVideoWidthKey: NSNumber(integerLiteral: 1920),\n    AVVideoHeightKey: NSNumber(integerLiteral: 1080),\n    AVVideoScalingModeKey: AVVideoScalingModeResizeAspectFill,\n    AVVideoCompressionPropertiesKey: compressionDict\n]\nlet audioOutputConfig = [\n    AVFormatIDKey: kAudioFormatMPEG4AAC,\n    AVEncoderBitRateKey: NSNumber(integerLiteral: 128000),\n    AVNumberOfChannelsKey: NSNumber(integerLiteral: 2),\n    AVSampleRateKey: NSNumber(value: Float(44100))\n]\n\nlet asset = AVAsset(url: Bundle.main.url(forResource: \"TestVideo\", withExtension: \"mov\")!)\nasset.nextlevel_export(outputURL: tmpURL, videoOutputConfiguration: videoOutputConfig, audioOutputConfiguration: audioOutputConfig)\n```\n\nAlternatively, you can use `NextLevelSessionExporter` directly.\n\n``` Swift\nlet exporter = NextLevelSessionExporter(withAsset: asset)\nexporter.outputFileType = AVFileType.mp4\nlet tmpURL = URL(fileURLWithPath: NSTemporaryDirectory(), isDirectory: true)\n    .appendingPathComponent(ProcessInfo().globallyUniqueString)\n    .appendingPathExtension(\"mp4\")\nexporter.outputURL = tmpURL\n\nlet compressionDict: [String: Any] = [\n    AVVideoAverageBitRateKey: NSNumber(integerLiteral: 6000000),\n    AVVideoProfileLevelKey: AVVideoProfileLevelH264HighAutoLevel as String,\n]\nexporter.videoOutputConfiguration = [\n    AVVideoCodecKey: AVVideoCodec.h264,\n    AVVideoWidthKey: NSNumber(integerLiteral: 1920),\n    AVVideoHeightKey: NSNumber(integerLiteral: 1080),\n    AVVideoScalingModeKey: AVVideoScalingModeResizeAspectFill,\n    AVVideoCompressionPropertiesKey: compressionDict\n]\nexporter.audioOutputConfiguration = [\n    AVFormatIDKey: kAudioFormatMPEG4AAC,\n    AVEncoderBitRateKey: NSNumber(integerLiteral: 128000),\n    AVNumberOfChannelsKey: NSNumber(integerLiteral: 2),\n    AVSampleRateKey: NSNumber(value: Float(44100))\n]\n\nexporter.export(progressHandler: { (progress) in\n    print(progress)\n}, completionHandler: { result in\n    switch result {\n    case .success(let status):\n        switch status {\n        case .completed:\n            print(\"NextLevelSessionExporter, export completed, \\(exporter.outputURL?.description ?? \"\")\")\n            break\n        default:\n            print(\"NextLevelSessionExporter, did not complete\")\n            break\n        }\n        break\n    case .failure(let error):\n        print(\"NextLevelSessionExporter, failed to export \\(error)\")\n        break\n    }\n})\n```\n\n## Documentation\n\nYou can find [the docs here](https://nextlevel.github.io/NextLevelSessionExporter). Documentation is generated with [jazzy](https://github.com/realm/jazzy) and hosted on [GitHub-Pages](https://pages.github.com).\n\n## Community\n\n- Found a bug? Open an [issue](https://github.com/NextLevel/NextLevelSessionExporter/issues).\n- Feature idea? Open an [issue](https://github.com/NextLevel/NextLevelSessionExporter/issues).\n- Want to contribute? Submit a [pull request](https://github.com/NextLevel/NextLevelSessionExporter/pulls).\n\n## Resources\n\n* [AV Foundation Programming Guide](https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/AVFoundationPG/Articles/00_Introduction.html)\n* [AV Foundation Framework Reference](https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVFoundationFramework/)\n* [NextLevel](https://github.com/NextLevel/NextLevel), Rad Media Capture in Swift\n* [GPUImage2](https://github.com/BradLarson/GPUImage2), image processing library in Swift\n* [SDAVAssetExportSession](https://github.com/rs/SDAVAssetExportSession), media transcoding library in obj-c\n\n## License\n\n`NextLevelSessionExporter` is available under the MIT license, see the [LICENSE](https://github.com/NextLevel/NextLevelSessionExporter/blob/master/LICENSE) file for more information.\n","funding_links":[],"categories":["Libs","HarmonyOS","Video [🔝](#readme)"],"sub_categories":["Video","Windows Manager"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNextLevel%2FNextLevelSessionExporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FNextLevel%2FNextLevelSessionExporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FNextLevel%2FNextLevelSessionExporter/lists"}