moritzmhmk / homebridge-camera-rpi

raspberry pi camera plugin for homebridge
MIT License
159 stars 29 forks source link

Inconsistent white balance #37

Open jankais3r opened 6 years ago

jankais3r commented 6 years ago

In the Live streaming mode the camera picture is correctly white-balanced. However, the static snapshots have this awful yellow tint.

See here: https://imgur.com/YfVnA7Y

We start with a yellow tint, then I switch to the Live mode and the picture gets properly white-balanced, then I exit the Live mode and another yellow snapshot gets generated.

Would it be possible to use the same settings for both the Live feed and the snapshots?

moritzmhmk commented 6 years ago

Seems like the first seconds of livestream have the same tint.

Maybe I could try to capture a few seconds before taking a snapshot... but that would probably break things like live notifications on motion detection, door bell etc. because of the delay.

jankais3r commented 6 years ago

The first seconds of livestream (at least for me) are not an actual livestream. They have the same tint, some artifacts and it's just a still picture without any movement. Once the frames start moving, they start with the right color balance right away.

moritzmhmk commented 6 years ago

Here you could add the option -ss 1.0 to seek the first second (or more maybe) and try if it helps with the tint. I can't test this currently.

jankais3r commented 6 years ago

img_2702 This is a result of adding -ss 1.0. I tried adding it to the input part, to the output part and to both parts of the command. Same result for all of them. :(

moritzmhmk commented 6 years ago

Does using something longer than 1.0 seconds change the effect?

jankais3r commented 6 years ago

This is what -ss 3.0 looks like. img_2356

moritzmhmk commented 6 years ago

does something like 15s look any better?

jankais3r commented 6 years ago
  let ffmpegCommand = `\
-f video4linux2 -input_format mjpeg -ss 15.0 -video_size ${request.width}x${req$
-vframes 1 -f mjpeg -`

the only notable difference is that it now takes longer to generate this crappy snapshot

img_2790

jankais3r commented 6 years ago

Would it be possible to generate the static snapshots using raspistill instead of ffmpeg? It seems that people are getting better quality photos with it.

jankais3r commented 5 years ago

Would it be possible to generate the static snapshots using raspistill instead of ffmpeg? It seems that people are getting better quality photos with it.

To answer my own question, it is possible and it gives better results. See comparison below. I'll submit a pull request tonight after I do some more testing. camera