Raspberry pi camera not working

it’s seems the startup procedure is not correct for astroprint to control the raspi cam
we have the same problem even if enable the raspi camera from rapsi-config
but got it work with the following sequence :-1:

from astroprint

  1. select rapi camera
  2. go to video stream < ---- must not work
  3. select snapshot and take photo <---- can take picture from raspi-cam
  4. select stream again, it will work :smile:
  5. if not, select usb camera and repeat step 2

this is my case on Pi3, with different version of raspi-camera

Ah, one sec. if the camera takes photos but no video we also need to look at webrtc compatibility. What browser are trying to see th video on?

im also having problem with the Raspberry Pi NoIR Camera Module V2 the camera works just when i select 1080p it says that this resolution isnt supported by your camera and it is. 720P works but not 1080P on the newest release.

It would be related to how the camera reports its supported modes. What does running this command output:

v4l2-ctl --list-formats-ext -d /dev/video0

Type : Video Capture
Pixel Format: ‘UYVY’
Name : UYVY 4:2:2
Size: Stepwise 32x32 - 3280x2464 with step 2/2

    Index       : 9
    Type        : Video Capture
    Pixel Format: 'NV12'
    Name        : Y/CbCr 4:2:0
            Size: Stepwise 32x32 - 3280x2464 with step 2/2

    Index       : 10
    Type        : Video Capture
    Pixel Format: 'BGR3'
    Name        : 24-bit BGR 8-8-8
            Size: Stepwise 32x32 - 3280x2464 with step 2/2

    Index       : 11
    Type        : Video Capture
    Pixel Format: 'YV12'
    Name        : Planar YVU 4:2:0
            Size: Stepwise 32x32 - 3280x2464 with step 2/2

    Index       : 12

Ugh! it’s giving a range… We’ll need to make changes to support this.

2 Likes

It seems as if a completely different issue has taken control of this issue, so i’m going to try and gain back the original issue.

That did help me a lot. I’m going to make a step by step guide on how to get the webcam stream from raspi cam working.

  1. Install astroprint as you would normally

  2. Run
    sudo apt-get update
    sudo apt-get install git-core
    cd
    git clone git://git.drogon.net/wiringPi
    cd ~/wiringPi
    git pull origin
    cd ~/wiringPi
    ./build
    That will get WiringPi good to go

  3. Now run
    nano camerafix.sh
    Then paste

    #!/bin/bash
    gpio -g mode 0 in
    gpio -g mode 1 in
    gpio -g mode 28 alt0
    gpio -g mode 29 alt0

    or (I havn’t tested this one yet)

    #!/bin/bash
    gpio -g mode 0 in
    gpio -g mode 1 in

    Then press Contol+X then Y then Enter

  4. Now you run chmod +x camerafix.sh and then go to the web interface camera page and you will see that there is now a nice blue button that says ‘Start Streaming Video’ !

  5. I think you need to do this every time you start it up so now to make it run at startup, run sudo nano /etc/rc.local and at the line just above exit 0 put the command from number 4 there so it should look like this:

    -#
    -# By default this script does nothing.

    -# Print the IP address
    -_IP=$(hostname -I) || true
    -if [ “$_IP” ]; then
    -printf “My IP address is %s\n” “$_IP”
    -fi
    -chmod +x camerafix.sh
    -exit 0

    Then press Contol+X then Y then Enter

I have done this and it 100% works. Don’t know how it would be possible to fix in the software itself. Also, how can I make a timelapse?

1 Like

will try this tomorrow thanks for the tutorial dude , ill feedback my results

didnt work for me :frowning:

Index       : 4
Type        : Video Capture
Pixel Format: 'H264' (compressed)
Name        : H.264
	Size: Stepwise 32x32 - 2592x1944 with step 2/2

Is it possible to force a resolution? Should a feature request be added to support video resolution ranges?

To get my Raspicam to work (was a fresh install), i had to do following:
Update to the latest Version and reboot

sudo raspi-config
  • 5 - Interfacing Options Configure connections to peripherals
  • P1 - Camera Enable/Disable connection to the Raspberry Pi Camera
  • <yes>
2 Likes

Thanks for that. For some reason it must have been disabled because this fixed it. A bit weird as I built an identical cam and pi3 with Octoprint and it worked without needing to do that. I am trying Astro as Octoprint constantly looses comms with my CR10.

The OctoPi image might enable raspicam by default. We don’t because only a small portion of our users use it and enabling it reduces the amount of RAM memory available to the software.

Hi I was wondering if this has beed solved already? Im having the same problem, not possible to change to the highest res with pi cam v2.
Thanks

I have Raspberry pi B+ with raspicam and the video streaming was working since Astrobox version 0.9(x) but the recent updates broke it.

After some debugging it appears the janus gateway is crashing with Segmentation fault and the web interface would display Unable to start the WebRTC system and you are left with a janus zombie process.

So I end up recompile my own janus gateway and now my video streaming is working even better than before. I am currently running Astrobox 0.12(5)

an easy way to check is to run command ‘ps -ef | grep janus’ and see if you have an zombie janus process with the AstroBox python as it’s parent after you fail to stream video.

I followed this guide to compile janus 0.2.6
https://www.rs-online.com/designspark/building-a-raspberry-pi-2-webrtc-camera

Here is my steps to fix this.

$ sudo aptitude install libmicrohttpd-dev libjansson-dev libnice-dev libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev libopus-dev libogg-dev libini-config-dev libcollection-dev pkg-config gengetopt libtool automake dh-autoreconf

$ sudo aptiude install lua5.3-dev libsrtp2-dev

$ wget https://github.com/meetecho/janus-gateway/archive/v0.2.6.tar.gz

$ tar zxvf v0.2.6.tar.gz

$ cd janus-gateway-0.2.6

$ sh autogen.sh

$ ./configure --disable-websockets --disable-data-channels --disable-rabbitmq --disable-docs --prefix=/opt/janus

$ make

$ sudo make install

$ sudo make configs

Next is to back up /usr/bin/janus, /etc/astrobox/janus/janus.cfg /etc/astrobox/janus/janus.cfg.local

$ sudo mv /usr/bin/janus /usr/bin/janus.org

$ sudo ln -s /opt/janus/bin/janus /usr/bin/

update the janus.cfg and janus.cfg.local to point plugins_folder, transports_folder and events_folder to /opt/janus/lib/janus folders respectively

un-comment log_to_file (as the logging is not disabled for this compile).

When I run the janus directly, there is no more Segmentation fault. and my video stream is working after rebooting the raspberry pi.

1 Like

Did this work for the video stream through the Android app? I was able to get the video stream working through the web interface in Chrome but still doesn’t work via the mobile app.

I have not tried Android app but streaming for the monitor in my astroprint cloud account is still broken. So I assuming there is something wrong with the stun server function still.

By the way, it turns out the root cause of my issue is that the current available janus package from the astroprint repository (0.2.5-1) simple crash on my Raspberry Pi B+. It actually did not have anything to do with astroprint software. and even when I tried to downgrade, I could not found a different version janus package on astroprint repository that used to work.

Also, STUN server required use of websockets transport, but this was disabled from my initial compile so that’s why the remote monitor function does not work.

I tried to build again from the previous build directory by running

$ sudo apt update
$ sudo apt install libcurl4-openssl-dev libwebsockets-dev cmake
$ make clean
$./configure --disable-data-channels --disable-rabbitmq --disable-docs --prefix=/opt/janus
$ make
$ sudo make install
and now the remote monitor is also working.

P.S. when you upgrade astroprint software. it would also overwrite the janus.cfg and janus.cfg.local in /etc/astrobox/janus/ and break this fix. Make a copy of the working janus.cfg and janus.cfg.local and put it back. The only changes I had to make is the make sure the plugins_folder, transports_folder and events_folder are point to the right locations where you compiled and not the system ones (i.e. /opt/janus/lib/janus)

This fix the problem for me too.

1 Like

Buenos dias, Daniel por casualidad hay alguna solucion al problema de la resolucion de la camara de raspberry seria muy bueno poder usarla en fullHD
gracias
Maximo