Pi Camera V3/IMX Chipset Based Cameras Not Working

Thank you for the script I am going to test it this morning.

do we need to reboot here ? I don't think so
I did this as the whilst reading through the list that sudo apt-get update && sudo apt-get -y dist-upgrade produces, one of the daemons said please reboot. I can remember what it was, so I just thought it was nesscary.

What are these extra packages used for?

sudo apt install -y cmake libboost-program-options-dev libdrm-dev libexif-dev

Big thanks to ltlowe and Dark360

I ran the script and my Camera Module 3 is running great. Script took about 10 minutes to run

Running a fresh install of OctoPi 1.0.0 RC3 on a 4GB Pi 4 Model B

Note that you must not run the script itself as sudo, otherwise git will throw an error

I uncommented the last line and the camera was working as soon as octopi came back up

I'm sure autofocus will be sorted out soon, but for now I've installed the Camera Settings plugin, I selected dw9807 10-000c and that provides a Focus Absolute option that works for manually focusing.

2 Likes

@Dark360 Thank you for figuring our what was needed in the first place.

I don't know if the other packages are needed. I pulled together two of your posts to make it work, planning to prune and change as I figure out more. I think those entris were from the other post, but they could be from something I was reading about libcamera.

I've also removed the addition to octopi.txt since it isn't needed when using the streamer.

I've just had a termal runaway so likely won't be trying anymore camera stuff until I figure out the thermal issue :frowning: . I am happy to host the script and any changes in github though.

One last thing is that there is a newer, unreleased version of camera-stream that adds width and height settings for stream and snapshot. I was going to try it and see if it fixed the scaling, but didn't get to it.

Thank you ltlowe and Dark360. I'm not good enough with linux to figure all this out. And the script causes a problem, I ran it line by line and the "make" command gives a long list of error messages, this is a copy of the last line without an error, then a few error messages. It must be user error, but I can't figure it out. Thanks for any help.

[100%] Linking CXX static library libdatachannel-static.a

make[4]: Leaving directory '/home/pi/camera-streamer/third_party/libdatachannel/build'

[100%] Built target datachannel-static

make[3]: Leaving directory '/home/pi/camera-streamer/third_party/libdatachannel/build'

make[2]: Leaving directory '/home/pi/camera-streamer/third_party/libdatachannel/build'

make[1]: Leaving directory '/home/pi/camera-streamer/third_party/libdatachannel/build'

cc -std=gnu17 -MMD -Werror -Wall -g -I/home/pi/camera-streamer -D_GNU_SOURCE -DUSE_FFMPEG -DUSE_LIBCAMERA -I/usr/include/libcamera -DUSE_RTSP -I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment -DUSE_LIBDATACHANNEL -Ithird_party/libdatachannel/include -Ithird_party/libdatachannel/deps/json/include -c -o device/buffer.o device/buffer.c

cc -std=gnu17 -MMD -Werror -Wall -g -I/home/pi/camera-streamer -D_GNU_SOURCE -DUSE_FFMPEG -DUSE_LIBCAMERA -I/usr/include/libcamera -DUSE_RTSP -I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment -DUSE_LIBDATACHANNEL -Ithird_party/libdatachannel/include -Ithird_party/libdatachannel/deps/json/include -c -o device/buffer_list.o device/buffer_list.c

cc -std=gnu17 -MMD -Werror -Wall -g -I/home/pi/camera-streamer -D_GNU_SOURCE -DUSE_FFMPEG -DUSE_LIBCAMERA -I/usr/include/libcamera -DUSE_RTSP -I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment -DUSE_LIBDATACHANNEL -Ithird_party/libdatachannel/include -Ithird_party/libdatachannel/deps/json/include -c -o device/buffer_lock.o device/buffer_lock.c

cc -std=gnu17 -MMD -Werror -Wall -g -I/home/pi/camera-streamer -D_GNU_SOURCE -DUSE_FFMPEG -DUSE_LIBCAMERA -I/usr/include/libcamera -DUSE_RTSP -I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment -DUSE_LIBDATACHANNEL -Ithird_party/libdatachannel/include -Ithird_party/libdatachannel/deps/json/include -c -o device/buffer_queue.o device/buffer_queue.c

cc -std=gnu17 -MMD -Werror -Wall -g -I/home/pi/camera-streamer -D_GNU_SOURCE -DUSE_FFMPEG -DUSE_LIBCAMERA -I/usr/include/libcamera -DUSE_RTSP -I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment -DUSE_LIBDATACHANNEL -Ithird_party/libdatachannel/include -Ithird_party/libdatachannel/deps/json/include -c -o device/device.o device/device.c

cc -std=gnu17 -MMD -Werror -Wall -g -I/home/pi/camera-streamer -D_GNU_SOURCE -DUSE_FFMPEG -DUSE_LIBCAMERA -I/usr/include/libcamera -DUSE_RTSP -I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment -DUSE_LIBDATACHANNEL -Ithird_party/libdatachannel/include -Ithird_party/libdatachannel/deps/json/include -c -o device/device_list.o device/device_list.c

cc -std=gnu17 -MMD -Werror -Wall -g -I/home/pi/camera-streamer -D_GNU_SOURCE -DUSE_FFMPEG -DUSE_LIBCAMERA -I/usr/include/libcamera -DUSE_RTSP -I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment -DUSE_LIBDATACHANNEL -Ithird_party/libdatachannel/include -Ithird_party/libdatachannel/deps/json/include -c -o device/links.o device/links.c

cc -std=gnu17 -MMD -Werror -Wall -g -I/home/pi/camera-streamer -D_GNU_SOURCE -DUSE_FFMPEG -DUSE_LIBCAMERA -I/usr/include/libcamera -DUSE_RTSP -I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment -DUSE_LIBDATACHANNEL -Ithird_party/libdatachannel/include -Ithird_party/libdatachannel/deps/json/include -c -o output/http_ffmpeg.o output/http_ffmpeg.c

cc -std=gnu17 -MMD -Werror -Wall -g -I/home/pi/camera-streamer -D_GNU_SOURCE -DUSE_FFMPEG -DUSE_LIBCAMERA -I/usr/include/libcamera -DUSE_RTSP -I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment -DUSE_LIBDATACHANNEL -Ithird_party/libdatachannel/include -Ithird_party/libdatachannel/deps/json/include -c -o output/http_h264.o output/http_h264.c

cc -std=gnu17 -MMD -Werror -Wall -g -I/home/pi/camera-streamer -D_GNU_SOURCE -DUSE_FFMPEG -DUSE_LIBCAMERA -I/usr/include/libcamera -DUSE_RTSP -I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment -DUSE_LIBDATACHANNEL -Ithird_party/libdatachannel/include -Ithird_party/libdatachannel/deps/json/include -c -o output/http_hls.o output/http_hls.c

cc -std=gnu17 -MMD -Werror -Wall -g -I/home/pi/camera-streamer -D_GNU_SOURCE -DUSE_FFMPEG -DUSE_LIBCAMERA -I/usr/include/libcamera -DUSE_RTSP -I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment -DUSE_LIBDATACHANNEL -Ithird_party/libdatachannel/include -Ithird_party/libdatachannel/deps/json/include -c -o output/http_jpeg.o output/http_jpeg.c

cc -std=gnu17 -MMD -Werror -Wall -g -I/home/pi/camera-streamer -D_GNU_SOURCE -DUSE_FFMPEG -DUSE_LIBCAMERA -I/usr/include/libcamera -DUSE_RTSP -I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment -DUSE_LIBDATACHANNEL -Ithird_party/libdatachannel/include -Ithird_party/libdatachannel/deps/json/include -c -o output/output.o output/output.c

cc -std=gnu17 -MMD -Werror -Wall -g -I/home/pi/camera-streamer -D_GNU_SOURCE -DUSE_FFMPEG -DUSE_LIBCAMERA -I/usr/include/libcamera -DUSE_RTSP -I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment -DUSE_LIBDATACHANNEL -Ithird_party/libdatachannel/include -Ithird_party/libdatachannel/deps/json/include -c -o cmd/camera-streamer/http.o cmd/camera-streamer/http.c

cc -std=gnu17 -MMD -Werror -Wall -g -I/home/pi/camera-streamer -D_GNU_SOURCE -DUSE_FFMPEG -DUSE_LIBCAMERA -I/usr/include/libcamera -DUSE_RTSP -I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment -DUSE_LIBDATACHANNEL -Ithird_party/libdatachannel/include -Ithird_party/libdatachannel/deps/json/include -c -o cmd/camera-streamer/main.o cmd/camera-streamer/main.c

cc -std=gnu17 -MMD -Werror -Wall -g -I/home/pi/camera-streamer -D_GNU_SOURCE -DUSE_FFMPEG -DUSE_LIBCAMERA -I/usr/include/libcamera -DUSE_RTSP -I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment -DUSE_LIBDATACHANNEL -Ithird_party/libdatachannel/include -Ithird_party/libdatachannel/deps/json/include -c -o cmd/camera-streamer/opts.o cmd/camera-streamer/opts.c

cc -std=gnu17 -MMD -Werror -Wall -g -I/home/pi/camera-streamer -D_GNU_SOURCE -DUSE_FFMPEG -DUSE_LIBCAMERA -I/usr/include/libcamera -DUSE_RTSP -I/usr/include/liveMedia -I/usr/include/groupsock -I/usr/include/BasicUsageEnvironment -I/usr/include/UsageEnvironment -DUSE_LIBDATACHANNEL -Ithird_party/libdatachannel/include -Ithird_party/libdatachannel/deps/json/include -c -o cmd/list-devices/main.o cmd/list-devices/main.c

I don't know what's wrong with your system, but I can tell you the steps which absolutely definitely work.

Download the Octoprint RC3 release image here:
https://unofficialpi.org/Distros/OctoPi/nightly/2022-10-27_2022-09-22-octopi-bullseye-armhf-lite-1.0.0.zip

Flash it to a microsd card, boot up the raspberry pi as usual, don't do anything else on it yet.

Log in, either locally or via SSH, doesn't matter.
Then run the following:

wget https://raw.githubusercontent.com/ltlowe/misc/main/cam3install.sh
chmod +x cam3install.sh
./cam3install.sh

restart your system.

That should just work. If it doesn't, then you need to provide more info about what you are actually doing, as there are extremely few steps to this process.

6 Likes

Thank you for the help. And it seems to work, but I get the same series of error messages. Here's what I did:

  • download the file with your link
  • using Raspberry Pi Imager I first formatted the 32GB SD card
  • using Raspberry Pi Imager I flashed the card - I did add these details in the imager:
    • hostname is now MK3S2
    • enabled SSH with password authentication
    • set password for user "pi" to my personal password
    • configured the wireless lan to my own
    • set the local settings to America/Denver and keyboard layout us
    • telemetry is enabled
  • logging in with ssh (this is where the log file starts)
  • following your steps - wget, chmod and running the script
  • at the end of the script the error message appear, but the script continues
  • restarting the pi
  • starting octopi with the ip address
  • runs fine the first time, but I see purple bands in the window on the control screen
  • restarting the system, now the window on the control screen is fine, except the auto focus doesn't work.

So two questions left: why the error messages from the script, and why no auto focus.

The terminal log file is here: Dropbox - cam3install log.txt - Simplify your life

And I'm installing on Raspberry Pi 4 Model B Rev 1.1 with 4GB of memory

Thanks again for your help, Hubert

I believe you are mistaking a verbose compiler output for an error message. The log messages you see are just compiler commands that are being executed as part of the script and those commands contain the -Werror flag.

If you check the source code of the script it calls sudo make install on the camera-streamer source code. If you check the Makefile for camera-streamer you will find -Werror as part of the CFLAGS. This flag is telling the C compiler to treat all compiler warnings as errors (thus failing the compile in case of a warning instead of finishing it).

TL;DR, all seems good and there are no actual warnings or errors in your outputs.

Thanks, and indeed those are warnings. Which were frowned upon when I learned to code, but that is a lifetime ago.

--Hubert

Thanksgambling, ltlowe and Dark360

I finally got this working, on a pi 3, following gamblings instructions precisely.,

In particular, I used the armhf image instead of the 64 bit image.
Also I noticed the admonition to flash the card, boot and do nothing before running the script. In the past I'd restored octoprint from a backup before doing any shell commands.

I don't know if either or both to those things made the difference, but I'm seeing the camera now.

Thanks again!

I also use that exact method and it work direclty! Not even needed to update, they were all already done.

I tested a print, and timelapse with octolapse is working fine!

  1. My focus was not bad, didnt try to play with it. Can someone post common cmd line to adjust manual focus?

  2. I'm an obico (spaguetti detective) user and i just discovered that obico for octoprint is not compatible with Pi OS Bullseye. But Obico for klipper is compatible with 32-bit Raspberry Pi OS version Buster or newer (like bullseye). Someone know if klipper can be installed on this image?
    During this time, i'm using octoeverywhere to view my printer from outside and it work great with the camera.

Thank you.

Will this script work with the 64 bit image (https://unofficialpi.org/Distros/OctoPi/nightly-arm64/2022-10-27_2022-09-22-octopi-bullseye-arm64-lite-1.0.0.zip)?

That should be fine, as that's what the original author said they tested it with.

If you install the Camera Settings plugin, there's an option in there for Focus Absolute which works for manually focusing

1 Like

I was able to get the 64bit version of octopi to work with the raspberry pi camera module 3
I was able to get obico for octoprint to work as well.
I was able to manually adjust the auto focus by installing the camera settings plugin and selecting dw9807 10-000c, then using the focus absolute option as mentioned above by xenos.

I did used the following nightly build that is 64bit.

https://unofficialpi.org/Distros/OctoPi/nightly-arm64/2023-01-23_2022-09-22-octopi-bullseye-arm64-lite-1.0.0.zip

I followed gambiting instructions above:

Flash it to a microsd card, boot up the raspberry pi as usual, don't do anything else on it yet.

Log in, either locally or via SSH, doesn't matter.
Then run the following:

wget https://raw.githubusercontent.com/ltlowe/misc/main/cam3install.sh
chmod +x cam3install.sh
./cam3install.sh

restart your system.

installed obico for octoprint, then camera settings plugin.

1 Like

Thanks Igeitner and xenox, manually adjust focus work perfecty with Camera Setting plugin.

Will give a try later for the 64bit version, the 32bit seam to be working really great actually.

Just dropping in to say thank you to the folks who got this working. It turns out to be a great shortcut for getting the Arducam 16MP AF camera running as well:

I guess I'm just using cam3install as a shortcut to to install camera-streamer, but it was an easy path to a known-good configuration so I could sort out the imx519 drivers.

Thanks again

1 Like

Using these instructions on a new RC3 install I was able to get my cam working properly. Focus is manually changeable through the camera settings plugin and I can confirm timelapse through Octolapse also works as intended. Currently runs at 640p but I'm happy with that for now. I'll hang in here while the tips keep coming!

Thanks @Dark360 @ltlowe @gambiting

1 Like

I followed the same instructions and is working too. Comment at the top of the cam3install.sh script states the latest daily build tested with - so worth checking that before flashing your sd card.

A word of warning though - 'Camera Settings' plugin doesn't seem to pick up the camera properly. As @lgeitner reports, you can select 'dw9807 10-000c' then adjust using the 'Focus Absolute' option (but not much else).

But what I experienced when trying to fine-tune focus was the plugin becoming less and less responsive - to the point where I had a blurred image and no amount of playing with the slider or the numbers would to make it respond properly. If only I'd stopped when the image was almost great...!

Tried the obvious things (restarting, re-installing the plugin etc) to no avail. In the end what worked for me was just keep playing with the slider until it comes back to life. I couldn't see a pattern to it beyond selecting the extremes (and random points in-between) over-and-over. Eventually it started to respond and I caught a focus that will do. Sharing in case anyone else finds themselves in a similar predicament...

I got problems too with 'Camera Settings' plugin, it slow down my octoprint.
I needed to desable it.

And with octolapse, I need to put a large delay 1000ms.
Is there a way to desable auto-focus ? I read that large delay on camera may be caused by auto-focus.

In fact, I don't really need auto-focus, I prefer to set it manually.

Thank you.

you'd have to run v4l2-ctl -d /dev/video0 --list-ctrls-menus (with your video device specified) to determine if it's possible.

If it is possible, then the command sudo v4l2-ctl --set-ctrl=focus_auto=0 should disable it.

1 Like