andi34 / photobooth

A Photobooth web interface for Linux and Windows.
MIT License
72 stars 39 forks source link

[BUG/INFORMATION]: No preview by device cam Pi Camera / Gphoto2 preview #362

Open andi34 opened 2 years ago

andi34 commented 2 years ago

Describe the bug

Original issue here https://github.com/andreknieriem/photobooth/issues/296

The device preview (Raspberry Camera v2) does not longer work in Chromium on buster based Pi OS.

Steps to reproduce the behavior

Try to take a picture in Chromium with exception in unsafely-treat-insecure-origin-as-secure. (preview picture not displayed, only countdown, no asking for permission to access webcam by Chromium).

Expected behavior

A preview from the device cam is displayed. Chromium asks for permission to access webcam.

Photobooth Version

Latest

Browser and browser version

Version: 90.0.4430.212 (Developer Build)

Operating System

Pi OS based on Debian Buster

Did it work before?

Yes

Latest working version

Chromium 88

Additional context

Workaround Using pi apps to downgrade chromium. Take a look at these links below:

Downgrade to Chromium v88 to get asked again for camera access.

Bullseye. For bullseye, legacy camera Interface should be enabled. raspistll will also be used again for taking pictures.

andi34 commented 2 years ago

Looks like it's nothing we can solve on Photobooth side. Someone need to fill a bug report for Chromium and/or Raspberry Pi foundation.

Keep the issue open as information. A workaround is mentioned in first Post of the issue.

andi34 commented 2 years ago

https://githubhelp.com/RPi-Distro/chromium-browser/issues/23?ref=https://githubhelp.com

andi34 commented 2 years ago

So, I just conducted some research with the following setup:

  • Raspberry Pi 3
  • Raspberry Pi Cam v2
  • fresh and unmodified installation latest Raspbian (Debian Bullseye-based), just installed all available updates via apt-get

Here are my findings:

  1. By default, the new Raspbian distribution comes with libcamera as a replacement for raspistill (libcamera is incompatible with the way raspistill works).
  2. When I started Chromium with a fresh updated installation relying on libcamera, Chromium asked for permission to access the camera but I couldn't get video from the camera to be displayed. So I went a more basic approach and tried to use libcamera-hello as test preview to see if the camera is detected and works in general. This fails with an error something like failed to import fd 19 -- same for libcamera-still -o test.jpeg. Yet, libcamera-still -o test.jpeg -n (-n is for no preview) works. I googled the error but couldn't find any solution which worked to resolve the issue. It seems this is something related to the video driver because it does work without displaying (previewing) the camera image(s).
  3. I switched to legacy camera interface via sudo raspi-config and got it working in Chromium instantaneously. Also raspistill works. However, raspistill and its variants are deprecated. So this does not seem to be a very future-proof way.

I can't understand why libcamera-hello does not work out-of-the-box with a fresh and clean installation of Raspbian using the original Raspberry Pi Camera v2.

Anyways, I you can live with the legacy interface for the camera, you're good to go with Raspbian (Bullseye) and the current version of Chromium.