https://github.com/levantaj/videoeditor
Merge & adjust volume of multiple audios into video
https://github.com/levantaj/videoeditor
audio audio-editor audio-processing cocoapods ios manupulation merge overlays swift video video-editor video-merge video-processing volume
Last synced: about 1 month ago
JSON representation
Merge & adjust volume of multiple audios into video
- Host: GitHub
- URL: https://github.com/levantaj/videoeditor
- Owner: levantAJ
- License: mit
- Created: 2020-10-17T09:48:14.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-11-08T03:20:29.000Z (over 4 years ago)
- Last Synced: 2025-04-09T10:49:58.058Z (about 1 month ago)
- Topics: audio, audio-editor, audio-processing, cocoapods, ios, manupulation, merge, overlays, swift, video, video-editor, video-merge, video-processing, volume
- Language: Swift
- Homepage:
- Size: 21.5 KB
- Stars: 13
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](http://cocoadocs.org/docsets/VideoEditor/)
[](http://cocoadocs.org/docsets/VideoEditor/)
[](https://www.apache.org/licenses/LICENSE-2.0.html)# 📽 VideoEditor
*VideoEditor* facilitates video editing## Requirements
- iOS 9.0 or later
- Xcode 11.0 or later## Install
### Installation with CocoaPods
```ruby
pod 'VideoEditor', '1.1'
```### Build Project
At this point your workspace should build without error. If you are having problem, post to the Issue and the
community can help you solve it.## How to use:
```swift
import VideoEditor
```### Merge multiple audios to a video.
1: Prepare the source video asset.
```swift
let videoAsset = VideoEditor.Asset(localURL: yourVideoLocalURL, volume: 1)
```
- With `volume`, you can able to adjust to volume of video in 0...12: Prepare the audios
```swift
let firstAudioAsset = VideoEditor.Asset(localURL: firstAudioLocalURL, volume: 0.5, startTime: .zero, duration: videoDuration)let secondAudioAsset = VideoEditor.Asset(localURL: secondAudioLocalURL, volume: 0.7, startTime: CMTime(seconds: 2, preferredTimescale: CMTimeScale(NSEC_PER_SEC)), duration: secondAudioDuration)
```- `startTime` is the point of time that you wanna add your audio into the final video, e.g. add set `startTime` as `CMTime(seconds: 3, preferredTimescale: CMTimeScale(NSEC_PER_SEC))` to tell engine to start add this audio from the third second of the final video.
- `duration` indicates how long the audio will be added into the final video from the `startTime`. Usually set it equal to the audio asset duration. Set `nil` to tell the `duration` is its duration.
3: Start to merge
```swift
let videoEditor = VideoEditor()
videoEditor.merge(video: videoAsset, audios: [firstAudioAsset, secondAudioAsset], progress: { progress in
print(progress)
}, completion: { result in
switch result {
case .success(let videoURL):
print(videoURL)
case .failure(let error):
print(error)
}
})
```## Author
- [Tai Le](https://github.com/levantAJ)## Communication
- If you **found a bug**, open an issue.
- If you **have a feature request**, open an issue.
- If you **want to contribute**, submit a pull request.## Licenses
All source code is licensed under the [MIT License](https://raw.githubusercontent.com/levantAJ/VideoEditor/master/LICENSE).