Skip to content

Add object detection, tracking, mobile notifications, and search to any security camera.

lower bitrate if streaming

roryclear269540f1fe86
diff --git a/clearcam/ViewController.m b/clearcam/ViewController.m
index d5416c7..8c53e85 100644
--- a/clearcam/ViewController.m
+++ b/clearcam/ViewController.m
@@ -465,7 +465,7 @@ NSMutableDictionary *classColorMap;
NSArray<NSString *> *exportPresets = [AVAssetExportSession allExportPresets];
if ([exportPresets containsObject:AVAssetExportPresetHEVCHighestQuality]) {
- // HEVC is supported
+ // HEVC is supported
videoSettings = @{
AVVideoCodecKey: AVVideoCodecTypeHEVC, // Use HEVC (H.265)
AVVideoWidthKey: @(videoWidth),
@@ -473,6 +473,14 @@ NSMutableDictionary *classColorMap;
AVVideoScalingModeKey: AVVideoScalingModeResizeAspectFill
};
}
+
+ if (self.isStreaming) {
+ NSMutableDictionary *mutableSettings = [videoSettings mutableCopy];
+ mutableSettings[AVVideoCompressionPropertiesKey] = @{
+ AVVideoAverageBitRateKey: @(500000)
+ };
+ videoSettings = [mutableSettings copy];
+ }
self.videoWriterInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:videoSettings];
self.videoWriterInput.expectsMediaDataInRealTime = YES;