Pi Camera V3/IMX Chipset Based Cameras Not Working

what I've done!

sudo apt-get update && sudo apt-get upgrade

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

edit
config.txt
Replace start_x=1 with dtoverlay=imx708

edit
octopi.txt
add to end of file
camera="libcamera"
camera_libcamera_options="-r 1280x720"

reboot

test libcamera with
libcamera-hello

Then use this guide:
https://docs.arducam.com/Raspberry-Pi-Camera/Native-camera/OctoPrint/

skip the first part of the guide
start with:"3.2. Test

7 Likes

I can confirm this works on the 1.0.0 RC3 Bullseye image - webcam and snapshot work.
I did notice that the auto focus didnt work with this method where it did with the official Bullseye image.
The camera Settings plugin works to manually control the focus though.

I also tried on the current Buster image and wouldnt work.
Lets hope 1.0.0 is realeased soon with libcamera and streamer baked in.

Thank you Stefan for the help

1 Like

You might want to pipe up in the 1.0.0rc3 issue ticket.

Hey how did you get the manual focus control to show up?
I installed the plugin suggested in that Arducam post and got everything else working (finally!) but the plugin settings shows lots of things but not focus. New to OctoPrint/OctoPi so any help much appreciated!

Thanks @Stefan for all this

Thanks @Stefan, those instructions got the camera working on the 1.0.0 RC3 Bullseye image!

Is any one else able to record a time lapse though? I'm able to view the cam, but attempting to have octoprint generate a Timelapse always fails after the print is done and it's compiling the time lapse. Throws up an ffmpeg error/dialog.

Rendering of timelapse PTFE Organizer_0.6n_0.3mm_PETG_MK3SMMU2S_2h6m_20230115172423 failed with return code -9

ffmpeg version 4.3.5-0+deb11u1+rpt2 Copyright (c) 2000-2022 the FFmpeg developers
,  built with gcc 10 (Raspbian 10.2.1-6+rpi1)
,  configuration: --prefix=/usr --extra-version=0+deb11u1+rpt2 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm
,  WARNING: library configuration mismatch
,  avutil      configuration: --prefix=/usr --extra-version=0+deb11u1+rpt2 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
,  avcodec     configuration: --prefix=/usr --extra-version=0+deb11u1+rpt2 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
,  avformat    configuration: --prefix=/usr --extra-version=0+deb11u1+rpt2 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
,  avdevice    configuration: --prefix=/usr --extra-version=0+deb11u1+rpt2 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
,  avfilter    configuration: --prefix=/usr --extra-version=0+deb11u1+rpt2 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
,  avresample  configuration: --prefix=/usr --extra-version=0+deb11u1+rpt2 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
,  swscale     configuration: --prefix=/usr --extra-version=0+deb11u1+rpt2 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
,  swresample  configuration: --prefix=/usr --extra-version=0+deb11u1+rpt2 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
,  postproc    configuration: --prefix=/usr --extra-version=0+deb11u1+rpt2 --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-mmal --enable-neon --enable-rpi --enable-v4l2-request --enable-libudev --enable-epoxy --enable-pocketsphinx --enable-libdc1394 --enable-libdrm --enable-vout-drm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
,  libavutil      56. 51.100 / 56. 51.100
,  libavcodec     58. 91.100 / 58. 91.100
,  libavformat    58. 45.100 / 58. 45.100
,  libavdevice    58. 10.100 / 58. 10.100
,  libavfilter     7. 85.100 /  7. 85.100
,  libavresample   4.  0.  0 /  4.  0.  0
,  libswscale      5.  7.100 /  5.  7.100
,  libswresample   3.  7.100 /  3.  7.100
,  libpostproc    55.  7.100 / 55.  7.100
,Input #0, image2, from '/home/pi/.octoprint/timelapse/tmp/PTFE Organizer_0.6n_0.3mm_PETG_MK3SMMU2S_2h6m_20230115172423-%d.jpg':
,  Duration: 00:00:01.76, start: 0.000000, bitrate: N/A
,    Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 4608x2592 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
,Stream mapping:
,  Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
,Press [q] to stop, [?] for help
,[swscaler @ 0x128a390] deprecated pixel format used, make sure you did set range correctly
,[libx264 @ 0x126a840] using SAR=1/1
,[libx264 @ 0x126a840] using cpu capabilities: ARMv6 NEON
,[libx264 @ 0x126a840] profile High, level 6.0, 4:2:0, 8-bit
,[libx264 @ 0x126a840] 264 - core 160 r3011 cde9a93 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=10000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
,Output #0, mp4, to '/home/pi/.octoprint/timelapse/.PTFE Organizer_0.6n_0.3mm_PETG_MK3SMMU2S_2h6m_20230115172423-fail.mp4':
,  Metadata:
,    encoder         : Lavf58,.45.100
,    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 4608x2592 [SAR 1:1 DAR 16:9], q=-1--1, 10000 kb/s, 25 fps, 12800 tbn, 25 tbc
,    Metadata:
,      encoder         : Lavc58.91.100 libx264
,    Side data:
,      cpb: bitrate max/min/avg: 0/0/10000000 buffer size: 0 vbv_delay: N/A
,[Parsed_movie_1 @ 0x126fed0] EOF timestamp not reliable
,frame=    2 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
,frame=    4 fps=2.7 q=0.0 size=       0kB time=00:00:00.00 bitrat,e=N/A speed=   0x    
,frame=    6 fps=2.7 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
,frame=    8 fps=2.7 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
,frame=   10 fps=2.6 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
,frame=   12 fps=2.6 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
,frame=   14 fps=2.6 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
,frame=   16 fps=2.6 q=0.0 size=       0kB time=00:00:00,.00 bitrate=N/A speed=   0x    
,frame=   18 fps=2.6 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
,frame=   20 fps=2.6 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
,frame=   22 fps=2.6 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
,frame=   24 fps=2.6 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
,frame=   26 fps=2.6 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
,frame=   28 fps=2.7 q=0.0 size=       0kB tim,e=00:00:00.00 bitrate=N/A speed=   0x    
,frame=   30 fps=2.7 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
,frame=   32 fps=2.7 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
,frame=   34 fps=2.7 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
,frame=   36 fps=2.7 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
,frame=   38 fps=2.8 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
,frame=   40 fps=2.8 q=0.0 size=    ,   0kB time=00:00:00.00 bitrate=N/A speed=   0x    
,frame=   42 fps=2.8 q=25.0 size=     256kB time=-00:00:00.07 bitrate=N/A speed=N/A    
,frame=   43 fps=1.5 q=32.0 size=     256kB time=-00:00:00.03 bitrate=N/A speed=N/A    
,frame=   44 fps=1.5 q=32.0 size=     256kB time=00:00:00.00 bitrate=26891487.2kbits/s speed=2.58e-06x    
,frame=   44 fps=1.4 q=32.0 size=     256kB time=00:00:00.00 bitrate=26891487.2kbits/s speed=2.42e-06x   

I have been messing around with ayufan/camera-streamer based on @jneilliii comments on Add support for raspberry pi camera V3.

I was able to get the v3 working without latency I was getting with the earlier process.

I will post my process after I test it with OctoPrint as I tested it on the latest Raspberry Pi 32bit Lite OS.

Make sure to test with the 1.0.0rc3 version of OctoPi image as the base OS will need to be bullseye I think for the camera-streamer app.

The base of the RaspOS 32bit Lite I used is Bullseye.

I manually installed OctoPrint using a guide from this forum and everything is working for me.

Not tested time lapse and I had to create a custom service file to get it to work.

I will be testing the RC3 soon.

I have the same problem, the official TimeLapse doesn't work and the Octolapse Plugin doesn't work with this camera, I also have the problem that the camera connects and disconnects while it is transmitting:

Done bringing up all configured video devices
/root/bin/webcamd: line 116: 8362 Segmentation fault LD_LIBRARY_PATH=. ./m jpg_streamer -o "output_http.so -w $camera_http_webroot $camera_http_options" -i "$input" (wd: /opt/mjpg-streamer)
Scanning again in two minutes

Does anyone know why this could be?
Thanks in advance

I tested RC3 this week using the following process:

sudo systemctl octoprint stop && sudo systemctl disable octoprint
sudo systemctl webcamd stop && sudo systemctl disable webcamd
sudo systemctl ffmpeg_hls stop && sudo systemctl disable ffmpeg_hls
sudo apt-get update && sudo apt-get -y dist-upgrade
sudo reboot
git clone --recursive -j8 GitHub - ayufan/camera-streamer: High-performance low-latency camera streamer for Raspberry PI's
sudo apt-get -y install libavformat-dev libcamera-dev liblivemedia-dev
cd camera-streamer/
make
sudo make install (This takes a while)
sudo reboot
cd camera-streamer/service
sudo nano camera-streamer-pi708-12MP.service
paste below

;
; Official Raspberry Pi v3 12MP camera based on the Sony IMX708 chip
; https://www.raspberrypi.com/products/camera-module-3/
;
[Unit]
Description=camera-streamer web camera
After=network.target
ConditionPathExists=/sys/bus/i2c/drivers/imx708/10-001a/video4linux

[Service]
ExecStart=/usr/local/bin/camera-streamer \
  -camera-path=/base/soc/i2c0mux/i2c@1/imx708@1a \
  -camera-type=libcamera \
  -camera-format=YUYV \
  ; 2304x1296-YUV420
  -camera-width=2304 -camera-height=1296 \
  -camera-fps=30 \
  ; use two memory buffers to optimise usage
  -camera-nbufs=2 \
  ; the high-res is 2304x1296
  -camera-high_res_factor=2 \
  ; the low-res is 576x324
  -camera-low_res_factor=4 \
  ; bump brightness slightly
  -camera-options=brightness=0.1 \
  -rtsp-port

DynamicUser=yes
SupplementaryGroups=video i2c
Restart=always
RestartSec=10
Nice=10
IOSchedulingClass=idle
IOSchedulingPriority=7
CPUWeight=20
AllowedCPUs=1-2
MemoryMax=250M

[Install]
WantedBy=multi-user.target

Ctrl + X to close and Y to save
sudo systemctl enable $PWD/camera-streamer-pi708-12MP.service && sudo systemctl start camera-streamer-pi708-12MP
sudo systemctl enable octoprint && sudo systemctl start octoprint

Webcam feeds works fine using default Webcam settings in Octoprint.

3 Likes

I've written a script based on Dark360's comments. It will install everything and reconfigure boot and systemd to use camera-streamer.

cam3install.sh

[Update 2023-02-05: Updated release in post 72 with 1080p and autofocus.]

#!/bin/bash

# Script to add Raspberry Pi Camera Module 3 to octopi 1.0 RC3
# Combining work from octoprint forums:
# https://community.octoprint.org/t/pi-camera-v3-not-working/49022/16
# https://community.octoprint.org/t/add-support-for-raspberry-pi-camera-v3/49052/5
#
# Tested on a clean install of Jan 20, 2023 Nightly build:
# 2023-01-20_2022-09-22-octopi-bullseye-arm64-lite-1.0.0
#

sudo systemctl stop webcamd && sudo systemctl disable webcamd
sudo systemctl stop octoprint && sudo systemctl disable octoprint
sudo systemctl stop ffmpeg_hls && sudo systemctl disable ffmpeg_hls

sudo apt-get update && sudo apt-get -y dist-upgrade

# do we need to reboot here ? I don't think so

sudo apt-get install -y libavformat-dev libcamera-dev liblivemedia-dev libjpeg-dev
sudo apt install -y cmake libboost-program-options-dev libdrm-dev libexif-dev


git clone --recursive -j8 https://github.com/ayufan/camera-streamer.git
cd camera-streamer/
make
sudo make install

# create 708 service
cat > service/camera-streamer-pi708-12MP.service << EOF
;
; Official Raspberry Pi v3 12MP camera based on the Sony IMX708 chip
; https://www.raspberrypi.com/products/camera-module-3/
;
[Unit]
Description=camera-streamer web camera
After=network.target
ConditionPathExists=/sys/bus/i2c/drivers/imx708/10-001a/video4linux

[Service]
ExecStart=/usr/local/bin/camera-streamer \\
  -camera-path=/base/soc/i2c0mux/i2c@1/imx708@1a \\
  -camera-type=libcamera \\
  -camera-format=YUYV \\
  ; 2304x1296-YUV420
  -camera-width=2304 -camera-height=1296 \\
  -camera-fps=30 \\
  ; use two memory buffers to optimise usage
  -camera-nbufs=2 \\
  ; the high-res is 2304x1296
  -camera-high_res_factor=2 \\
  ; the low-res is 576x324
  -camera-low_res_factor=4 \\
  ; bump brightness slightly
  -camera-options=brightness=0.1 \\
  -rtsp-port

DynamicUser=yes
SupplementaryGroups=video i2c
Restart=always
RestartSec=10
Nice=10
IOSchedulingClass=idle
IOSchedulingPriority=7
CPUWeight=20
AllowedCPUs=1-2
MemoryMax=250M

[Install]
WantedBy=multi-user.target

EOF

# update config.txt
sudo sed -i 's/start_x=1/dtoverlay=imx708/g' /boot/config.txt


#update octopi.txt
cat << EOF | sudo tee -a /boot/octopi.txt > /dev/null

#enable libcamera
camera="libcamera"
camera_libcamera_options="-r 1280x720"
EOF


# enable services

sudo systemctl enable $PWD/service/camera-streamer-pi708-12MP.service
sudo systemctl enable octoprint


#sudo reboot


The script pasted above is what I am using at the time of this post.
The link is to a file in github that I will update as changes are made.

[Update 2023-02-05: Updated release in post 72 with 1080p and autofocus.]

7 Likes

Hi, I've used the script above and the camera is indeed working in Octoprint now(required a couple restarts to show up, but it works), however the image is always out of focus. I cannot find any information anywhere on how to trigger the autofocus built into the module, does anyone know?

Mine seems to be focused correctly, but I wasn't convinced it was autofocusing so much as dumb luck :slightly_smiling_face:

If I figure it out I'll post a followup and update the script. If anyone else figures it out, please feel free to update the script as well.

I've also noticed that the resolution doesn't match what is specified in the service file so there may be an issue passing parameters.

I figured out why you had to reboot a couple times. The service is skipped if the driver hasn't loaded before systemd tries to start it.

I've commented out the ConditionPathExists line and added an ExecPreStart instead. That seems to ensure it tries to restart.

#ConditionPathExists=/sys/bus/i2c/drivers/imx708/10-001a/video4linux

[Service]
ExecStartPre=/usr/bin/test -e /sys/bus/i2c/drivers/imx708/10-001a/video4linux

I've updated the script in github with this change.

2 Likes

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