From 5dd710fc4769824cbab627cbbd343ce392580ab0 Mon Sep 17 00:00:00 2001 From: Ingo Oppermann Date: Mon, 16 Oct 2023 13:39:39 +0200 Subject: [PATCH] Fix detecting Raspberyy Pi camera v4l2 device, changing default format to yuv420p --- src/utils/restreamer.js | 2 +- src/views/Edit/Sources/Raspicam.js | 2 +- src/views/Edit/Wizard/Sources/Raspicam.js | 2 +- src/views/Edit/Wizard/Sources/V4L.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/restreamer.js b/src/utils/restreamer.js index 133c1a4..deff8fe 100644 --- a/src/utils/restreamer.js +++ b/src/utils/restreamer.js @@ -617,7 +617,7 @@ class Restreamer { // Split out a Raspberry Pi camera and create a dedicated source if (device.id === 'video4linux2') { for (let d of device.devices) { - if (d.extra.indexOf('bcm2835-v4l2') !== -1) { + if (d.extra.match(/bcm2835[-_]v4l2/) !== null) { if (!('raspicam' in skills.sources)) { skills.sources['raspicam'] = []; } diff --git a/src/views/Edit/Sources/Raspicam.js b/src/views/Edit/Sources/Raspicam.js index 4114dbf..ad6df0f 100644 --- a/src/views/Edit/Sources/Raspicam.js +++ b/src/views/Edit/Sources/Raspicam.js @@ -25,7 +25,7 @@ const initSettings = (initialSettings) => { const settings = { device: 'none', - format: 'h264', + format: 'yuv420p', framerate: '25', size: '1920x1080', ...initialSettings, diff --git a/src/views/Edit/Wizard/Sources/Raspicam.js b/src/views/Edit/Wizard/Sources/Raspicam.js index af7a523..de92d24 100644 --- a/src/views/Edit/Wizard/Sources/Raspicam.js +++ b/src/views/Edit/Wizard/Sources/Raspicam.js @@ -43,7 +43,7 @@ function initSettings(initialSettings, knownDevices) { } function initDevices(initialDevices) { - const devices = initialDevices.filter((device) => device.media === 'video' && device.extra.indexOf('bcm2835-v4l2') !== -1); + const devices = initialDevices.filter((device) => device.media === 'video' && device.extra.match(/bcm2835[-_]v4l2/) !== null); return devices; } diff --git a/src/views/Edit/Wizard/Sources/V4L.js b/src/views/Edit/Wizard/Sources/V4L.js index ff49282..055742b 100644 --- a/src/views/Edit/Wizard/Sources/V4L.js +++ b/src/views/Edit/Wizard/Sources/V4L.js @@ -49,7 +49,7 @@ function initSettings(initialSettings, knownDevices) { } function initDevices(initialDevices) { - const devices = initialDevices.filter((device) => device.media === 'video' && device.extra.indexOf('bcm2835-v4l2') === -1); + const devices = initialDevices.filter((device) => device.media === 'video' && device.extra.match(/bcm2835[-_]v4l2/) === null); return devices; }