Recorder Configuration
VideoKit Recorder allows to adjust the recording quality of your video clips.
Video and Audio Configuration
Using VKRecorderViewController
In order to change the recorder configuration of VKRecorderViewController, go ahead and extend your custom Recorder with VKRecorderViewController and set up the view controller delegate.
Then, in your view controller, you are able to change the video configuration in the delegate method configure(video: VKRecorderVideoConfiguration, audio: VKRecorderAudioConfiguration)
RecorderViewController.swift
import VideoKitRecorder
import AVFoundation
extension RecorderViewController: VKRecorderViewControllerDelegate {
func configure(video: VKRecorderVideoConfiguration, audio: VKRecorderAudioConfiguration) {
vkRecorder.frameRate = 30
video.bitRate = 6000000
video.maxKeyFrameInterval = 30
video.aspectRatio = .tiktok
video.dimensions = CGSize(width: 1080, height: 1920)
video.scalingMode = AVVideoScalingModeResizeAspect
video.codec = AVVideoCodecType.hevc
video.preset = .high
audio.bitRate = 44000
audio.channelsCount = 2
}
}
Using VKRecorder
If you are using VKRecorder and implement your own ViewController, you can directly access the public properties videoConfiguration
as well as audioConfiguration
:
MyCustomRecorderViewController.swift
import VideoKitRecorder
extension MyCustomRecorderViewController: UIViewController {
func viewDidLoad() {
VKRecorder.shared.frameRate = 30
VKRecorder.shared.videoConfiguration.bitRate = 6000000
VKRecorder.shared.videoConfiguration.maxKeyFrameInterval = 30
VKRecorder.shared.videoConfiguration.aspectRatio = .tiktok
VKRecorder.shared.videoConfiguration.dimensions = CGSize(width: 1080, height: 1920)
VKRecorder.shared.videoConfiguration.scalingMode = AVVideoScalingModeResizeAspect
VKRecorder.shared.videoConfiguration.codec = AVVideoCodecType.hevc
VKRecorder.shared.videoConfiguration.preset = .high
VKRecorder.shared.audioConfiguration.bitRate = 44000
VKRecorder.shared.audioConfiguration.channelsCount = 2
}
}
For a detailed list of all video and audio configuration options, please refer to our reference: