Big Sur
log stream --predicate 'eventMessage contains "Post event kCameraStream"'
only works up to macOS Big Sur
Monterey
On macOS Monterey you'll have to use a slightly different predicate:
$ log stream --predicate 'subsystem contains "com.apple.UVCExtension" and composedMessage contains "Post PowerLog"'
Timestamp Thread Type Activity PID TTL
2021-10-27 12:21:13.366628+0200 0x147c5 Default 0x0 353 0 UVCAssistant: (UVCExtension) [com.apple.UVCExtension:device] UVCExtensionDevice:0x1234005d7 [0x7fe3ce008ca0] Post PowerLog {
"VDCAssistant_Device_GUID" = "00000000-1432-0000-1234-000022470000";
"VDCAssistant_Power_State" = On;
}
2021-10-27 12:21:16.946379+0200 0x13dac Default 0x0 353 0 UVCAssistant: (UVCExtension) [com.apple.UVCExtension:device] UVCExtensionDevice:0x1234005d7 [0x7fe3ce008ca0] Post PowerLog {
"VDCAssistant_Device_GUID" = "00000000-1432-0000-1234-000022470000";
"VDCAssistant_Power_State" = Off;
}
Ventura
Here you can use log stream --predicate 'eventMessage contains "Cameras changed to"'
, which even gives you a list of active cameras:
Timestamp Thread Type Activity PID TTL
2023-03-20 14:07:56.340362+0100 0x21ee Default 0x0 1144 0 ControlCenter: [com.apple.controlcenter:video-effects] Cameras changed to [ControlCenterApp.VideoCamera(id: "FOO-0176-46F7-B185-BAR", name: "FaceTime HD-kamera", utType: Optional(<UTType 0xFOO1c41BAR> com.apple.macbookpro-16-2023 (not dynamic, declared)), batteryInfo: nil, deskViewID: nil, supportedEffects: [portrait], appEffects: [ControlCenterApp.AppVideoEffects(bundleIDs: Set(["com.apple.PhotoBooth"]), bundleNames: ["com.apple.PhotoBooth": "Photo Booth"], enabledEffects: Set([]), unavailableEffects: Set([]))])]
2023-03-20 14:08:09.114873+0100 0x21ee Default 0x0 1144 0 ControlCenter: [com.apple.controlcenter:video-effects] Cameras changed to []