Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No autofocus with rpiCamera source and rpiCameraAfMode: auto #2326

Closed
1 of 13 tasks
Ataman opened this issue Sep 11, 2023 · 10 comments · Fixed by #2552
Closed
1 of 13 tasks

No autofocus with rpiCamera source and rpiCameraAfMode: auto #2326

Ataman opened this issue Sep 11, 2023 · 10 comments · Fixed by #2552
Labels
bug Something isn't working rpi-camera

Comments

@Ataman
Copy link

Ataman commented Sep 11, 2023

Which version are you using?

v1.0.3

Which operating system are you using?

  • Linux amd64 standard
  • Linux amd64 Docker
  • Linux arm64 standard
  • Linux arm64 Docker
  • Linux arm7 standard
  • Linux arm7 Docker
  • Linux arm6 standard
  • Linux arm6 Docker
  • Windows amd64 standard
  • Windows amd64 Docker (WSL backend)
  • macOS amd64 standard
  • macOS amd64 Docker
  • Other (please describe)

Describe the issue

Autofocus mode auto with rpiCamera source doesn't seem to work i.e.: setting rpiCameraAfMode to auto doesn't achieve focus. I'm using a Raspberry Camera Module 3 connected to a RPi Zero W. Setting rpiCameraAfWindow to something like 0.25,0.25,0.5,0.5 didn't change anything. Using manual focus and setting the lens position works however and so does the continuous setting.
Server logs don't show anything suspicious.
Versions:
OS: Raspbian GNU/Linux 11 (bullseye)
libcamera: v0.0.5+83-bde9b04f
libfreetype6: 2.10.4+dfsg-1+deb11u1

Describe how to replicate the issue

  1. Start server with the following configs:
logLevel: debug
logDestinations: [syslog]
rtsp: yes
protocols: [tcp]
rtspAddress: :554
rtmp: no
hls: no
webrtc: no
srt: no

paths:
  live:
    source: rpiCamera
    rpiCameraCamID: 0
    rpiCameraWidth: 1280
    rpiCameraHeight: 720
    rpiCameraHFlip: False
    rpiCameraVFlip: False
    rpiCameraBrightness: 0.0
    rpiCameraContrast: 1
    rpiCameraSaturation: 1
    rpiCameraSharpness: 0
    rpiCameraExposure: auto
    rpiCameraAWB: auto
    rpiCameraDenoise: "cdn_off"
    rpiCameraShutter: 0
    rpiCameraMetering: centre
    rpiCameraGain: 0
    rpiCameraEV: 0
    rpiCameraHDR: false
    rpiCameraFPS: 30
    rpiCameraIDRPeriod: 60
    rpiCameraBitrate: 2000000
    rpiCameraProfile: main
    rpiCameraLevel: '4.1'
    rpiCameraAfMode: auto
    rpiCameraAfRange: normal
    rpiCameraAfSpeed: normal
    rpiCameraLensPosition: 0
  1. Connect with VLC to rtsp://<SERVER_IP>:554/live

Did you attach the server logs?

no

Did you attach a network dump?

no

@andreacampanella
Copy link

one up for this, I have the same problem

@aler9 aler9 added question Further information is requested rpi-camera labels Sep 15, 2023
@aler9
Copy link
Member

aler9 commented Sep 15, 2023

Hello, in order to control the RPI camera, the server uses the same API behind libcamera-vid.

Try using libcamera-vid with --autofocus-mode and --autofocus-window and post the results here.

If autofocus works with libcamera-vid, then there's a bug inside the server that can be solved, otherwise it's an issue that should be reported to libcamera maintainers.

@andreacampanella
Copy link

That's Fair enough, I will try as soon as I can

@Ataman
Copy link
Author

Ataman commented Sep 18, 2023

I made a mistake and wrote continous instead of continuous. Continuous auto focus does indeed work given the parameter is written correctly.

However, auto does not. It works fine with libcamera-vid (achieves focus on start and keeps it) whereas MediaMTX doesn't focus at all.

@LucHeart
Copy link

Agreed, same behavior observable here. Camera Module 3 + PI 4

@kanehekili
Copy link

Same here. Using rpiCameraAfMode: manual and rpiCameraLensPosition: 0.0 does not prevent from auto focus. Camera Module 3 with RP 2w zero

@aler9 aler9 added bug Something isn't working and removed question Further information is requested labels Oct 22, 2023
@aler9
Copy link
Member

aler9 commented Oct 22, 2023

i took another look at the sample libcamera apps and i found out that auto focus needs an initial scan, that was not triggered. Please try this nightly release and let me know if it fixes the issue.

@kanehekili your issue is off topic here, please open another issue and provide details on how to replicate.

[link removed]

@Ataman
Copy link
Author

Ataman commented Oct 23, 2023

@aler9 Your nightly release does indeed fix this issue, thank you for working on it!

@aler9
Copy link
Member

aler9 commented Oct 28, 2023

added in v1.2.1

Copy link
Contributor

github-actions bot commented May 1, 2024

This issue is being locked automatically because it has been closed for more than 6 months.
Please open a new issue in case you encounter a similar problem.

@github-actions github-actions bot locked and limited conversation to collaborators May 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working rpi-camera
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants