andi34 / photobooth

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

[Q]: Very Dark Video in Livestream Background (Countdown) with gphoto2 #395

Closed mhellmeier closed 2 years ago

mhellmeier commented 2 years ago

Describe the bug

With the help of gphoto2 it is possible to show a live stream of the camera as a background during the countdown. This is made by the following command:

gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0 > /dev/null 2>&1 & echo $!

When using an external flash, the default camera settings are adjusted for it (example: 1/200, f/10, ISO 400). This leads to a dark/black background during the countdown because the camera needs more light to show an adequate preview. The preview works and looks nice with other settings (like 1/10, f/4, ISO 1600) but this results in an overexposed photo with the flash.

Are there any ways to change the camera settings for the gphoto2 preview to create a lighter live video background? Or are there other possible solutions to solve the problem?

Steps to reproduce the behavior

(Already described above)

Expected behavior

Correctly exposed video background.

Photobooth Version

Latest dev branch

Browser and browser version

No response

Operating System

Raspbian

Did it work before?

No

Latest working version

No response

Additional context

No response

andi34 commented 2 years ago

You might want to use a video light which will be always on. Else there might be the possibility to adjust your Gphoto commands to set the iso and other settings via command line (--set-config name=value ), see http://www.gphoto.org/doc/remote/ for more information.

mhellmeier commented 2 years ago

Thanks a lot for the tip! I tested it by adding --set-config iso=6400 to the live view command but this doesn't work as expected. This changes the ISO value directly after (and not before) the live stream.

A possible solution to solve this problem is by adding a "config before live view" command section here: https://github.com/andi34/photobooth/blob/dev/api/takeVideo.php#L21

With this, the following commands can be executed:

  1. gphoto2 --set-config iso=6400
  2. gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0 > /dev/null 2>&1 & echo $!

Do you think it would be a good idea to extend the config with a new field "command before live view" option?

andi34 commented 2 years ago

What about gphoto2 --set-config iso=6400 && gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0 > /dev/null 2>&1 & echo $! ?

mhellmeier commented 2 years ago

; works: gphoto2 --set-config iso=6400; gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video0 > /dev/null 2>&1 & echo $!

andi34 commented 2 years ago

Great 👍 thanks for the feedback

mhellmeier commented 2 years ago

Maybe this information and tip can be added to the wiki?