Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions camera-ui-homekit/src/camera/accessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,19 @@ export class CameraAccessory extends Subscribed {
this.recordingDelegate?.refreshPrebuffer();
},
},
{
type: 'boolean',
key: 'forceVideoTranscodingForRecording',
title: 'Force Video Transcoding for HKSV',
description: 'Re-encode video for HomeKit Secure Video so its negotiated resolution, frame rate, and bitrate limits are applied.',
group: 'Advanced',
defaultValue: false,
store: true,
onSet: async (state: boolean) => {
this.cameraLogger.log('Force video transcoding for HKSV:', state);
this.recordingDelegate?.refreshPrebuffer();
},
},
]);
}

Expand Down
6 changes: 5 additions & 1 deletion camera-ui-homekit/src/camera/recordingSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,11 @@ export class RecordingSession extends EventEmitter {
];

await session.startStream({
supportedVideoCodecs: ['h264'],
// An empty supported-codec list deliberately makes node-av transcode the
// input to H.264. This is useful for cameras whose already-compatible
// H.264 stream exceeds the resolution, frame-rate, or bitrate negotiated
// by HomeKit: stream-copy mode cannot apply those encoder constraints.
supportedVideoCodecs: this.cameraAccessory.cameraStorage.values.forceVideoTranscodingForRecording ? [] : ['h264'],
supportedAudioCodecs: ['aac'],
boxMode: true,
fragDuration: (this.configuration?.mediaContainerConfiguration?.fragmentLength ?? 4000) * 1000,
Expand Down
1 change: 1 addition & 0 deletions camera-ui-homekit/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface CameraStorageValues {
republishId: string;
useHardwareAcceleration: boolean;
useHardwareAccelerationForRecording: boolean;
forceVideoTranscodingForRecording: boolean;
adaptiveStreamSource: boolean;
advertiser: string;
}