--- title: "Choose a camera" description: "List the cameras on USB with Camera.discover, open one by serial number with a device descriptor, and run multiple cameras from one process." url: https://darkgrade.com/docs/slate/guides/multiple-cameras last_updated: 2026-12-04 docs_index: https://darkgrade.com/docs/llms.txt --- # Choose a camera > List the cameras on USB with Camera.discover, open one by serial number with a device descriptor, and run multiple cameras from one process. > ## Documentation Index > Fetch the complete documentation index at: https://darkgrade.com/docs/llms.txt > Use this file to discover all available pages before exploring further. With one camera attached, Darkgrade Slate's `new Camera()` opens it. With several, say which one: list them with `Camera.discover()`, then pass a filter that matches exactly one. ```typescript import { Camera } from '@darkgrade/slate' const [first] = await Camera.discover() if (!first) throw new Error('No camera on USB') const { vendorId, serialNumber } = first const camera = new Camera({ device: { usb: { filters: [{ vendorId, serialNumber }] } }, }) await camera.connect() ``` ## List the cameras [`Camera.discover()`](https://darkgrade.com/docs/slate/getting_started/camera.md#cameradiscover) lists the PTP cameras on USB without opening a session on any of them. Each entry has `vendorId` and `productId`, and `serialNumber`, `manufacturer` and `model` when the device reports them: see [`DiscoveredCamera`](https://darkgrade.com/docs/slate/reference/types-results.md#discoveredcamera). `discover()` covers USB only. A camera on the network is opened by address: see [Wi-Fi with PTP/IP](https://darkgrade.com/docs/slate/getting_started/ptp-ip.md). ## Open one camera A [`DeviceDescriptor`](https://darkgrade.com/docs/slate/reference/types-workflow.md#devicedescriptor) says which device a `Camera` opens. Pass it to the constructor as `device`, or to [`connect({ device })`](https://darkgrade.com/docs/slate/getting_started/camera.md#connect) to override it for one connection. | `usb.filters[]` field | Matches | | - | - | | `vendorId` | One maker's cameras. The ids are in [Vendor IDs](https://darkgrade.com/docs/slate/ptp-reference/vendor-ids.md). | | `productId` | One model. | | `serialNumber` | One body. Use it whenever two of the same model are attached. | | `classCode`, `subclassCode`, `protocolCode` | A USB interface class. Without a descriptor, Slate matches any still-image (PTP) interface. | A device must match at least one filter and none of `usb.exclusionFilters`, which take the same fields. > [!WARNING] > > A descriptor must match exactly one camera. If it matches several, `connect()` throws `Multiple USB cameras match; select a unique serialNumber before connecting` and opens none of them. A filter field left `undefined` matches anything, so check that `discover()` gave you a `serialNumber` before you rely on it. ## Run multiple cameras Each `Camera` holds its own connection and its own queue, so separate cameras run side by side: ```typescript import { Camera } from '@darkgrade/slate' const found = await Camera.discover() const cameras = found.map(({ vendorId, productId, serialNumber }) => { const filters = [{ vendorId, productId, serialNumber }] return new Camera({ device: { usb: { filters } } }) }) await Promise.all(cameras.map(camera => camera.connect())) try { const photos = await Promise.all( cameras.map(camera => camera.takePhoto()), ) console.log(photos.map(photo => photo.name)) } finally { await Promise.allSettled(cameras.map(camera => camera.disconnect())) } ``` The photos are requested together, not triggered on the same instant: Slate does not synchronise shutters between cameras. To start and stop video on several cameras as one take, use [`VideoTake`](https://darkgrade.com/docs/slate/guides/video-takes.md). ## Tell which camera is which Once a camera is open, [`getInfo()`](https://darkgrade.com/docs/slate/getting_started/camera.md#getinfo) reads what the body says about itself: `manufacturer`, `model`, `firmware`, and `serialNumber` when the body reports one. To name a device before you open it, `identifyCamera` looks up its USB ids and returns a [`CameraIdentification`](https://darkgrade.com/docs/slate/reference/types-capabilities.md#cameraidentification): ```typescript import { Camera, identifyCamera } from '@darkgrade/slate' for (const { vendorId, productId } of await Camera.discover()) { const { status, candidates } = identifyCamera({ vendorId, productId }) console.log(status, candidates.map(candidate => candidate.models)) } ``` | `status` | Meaning | | - | - | | `'matched'` | One camera line uses these ids. | | `'ambiguous'` | Several lines share these ids. All are in `candidates`. | | `'unknown'` | Slate has no record of these ids. | | `'identity-mismatch'` | You passed `ptpModel` and it names none of the candidates. | Pass `ptpModel` (the `model` from `getInfo()`) to narrow an ambiguous match. Recognising a device says nothing about what it can do: [`getCapabilities()`](https://darkgrade.com/docs/functionality/connection.md#what-the-camera-can-do) does. ## One camera, several programs Only one program can hold a camera's USB session. To let an AI app, a script and your own UI use the same camera, hold it in one process and share that: see [Host cameras for other processes](https://darkgrade.com/docs/slate/guides/runtime.md). On macOS, the system's own camera service counts as one of those programs: it claims a camera as soon as it is plugged in. [Prepare your computer](https://darkgrade.com/docs/slate/getting_started/installation.md#prepare-your-computer) shows how to stop it with `killMacCameraDaemons()`.