No video from Raspberry Pi NoIR Camera


#1

Octoprint will not receive video from my raspberry pi NoIR camera. It's an element14 1.3 rev camera. Octoprint runs just fine with my Logitech C170 and the video feed works. I am using a Raspberry Pi 3 Model B running Octoprint 1.3.9, flashed from OctoPi 0.15.1 using Etcher. I have expanded the filesystem. i have also made the necessary changes to /boot/octopi.txt.

The light on the Pi cam turns on when Octoprint boots up. when i SSH into the pi, i can run vcgencmd get_camera and receive supported=1 detected=1 so the camera is being detected. i ran sudo raspi-config and enabled the camera. I can also run sudo /etc/init.d/webcamd stop and the light on the camera will turn off, and i can turn it back on by running sudo /etc/init.d/webcamd start. I know the cables are plugged in correctly and i am using the correct port on the raspberry pi.

I have been using this set up to run my MP Select Mini V2 for months now and purchased the C170 because i was not able to fix this issue in the past. I realized how poor the picture on the c170 is and decided to attempt using the raspberry pi camera again to no avail.

Any help would be great!


#2

The red LED comes on, which unless you've put the cable in correctly and haven't accidentally detached the lens from the PCB. Try grabbing a shot with "raspistill'; that will help narrow down the problem.


#3

As you insert it, it should be oriented like this:

And for the Raspi, the contact side of the cable should point toward the end of the board on the side of the microSD connection.


#4

Yup i have the cables connected correctly! as for using raspistill, this is the output of it.
pi@PrinterPi:~ $ raspistill -o cam.jpg mmal: mmal_vc_component_enable: failed to enable component: ENOSPC mmal: camera component couldn't be enabled mmal: main: Failed to create camera component mmal: Failed to run camera app. Please check for firmware updates


#5

Did you enable the camera support using sudo raspi-config?


#6

Yup! that was the first thing i did actually


#7

From this page...

Error : ENOSPC displayed. Camera is probably running out of GPU memory. Check config.txt in the /boot/ folder. The gpu_mem option should be at least 128.

/boot/config.txt

start_x=1
gpu_mem=128

#8

Yeah my config file has all that jazz in it too

# Additional overlays and parameters are documented /boot/overlays/README

Enable audio (loads snd_bcm2835)
dtparam=audio=on
enable raspicam
start_x=1
gpu_mem=128

tried increasing the gpu_mem value to 256 and im still not getting video feed and still getting the same error from raspistill


#9

Alright, well you've diligently installed the sucker and endured any attempts to question that.

I think I'd check dmesg and look for any whining.

Given the error message you received, it might actually help to "update the firmware", a.k.a. sudo apt-get update && sudo apt-get -y upgrade.

From the actual code itself:

   if (buffer->alloc_size < event->length) {
      LOG_ERROR("event buffer too small (%i/%i)", buffer->alloc_size, event->length);
      mmal_buffer_header_release(buffer);
      return MMAL_ENOSPC;
   }

It's all about GPU memory, it would seem. The log should indicate the length, though. This would suggest the GPU memory setting for this to be.

You might review /var/log/webcamd.log. Mine has the Pi NoIR v2 webcam, for what it's worth.

Starting up webcamDaemon...

--- Configuration: ----------------------------
camera:        auto
usb options:   -r 640x480 -f 10
raspi options: -fps 10
http options:  -w ./www-octopi -n
-----------------------------------------------

<13>Aug 30 19:15:31 pi: Starting Raspberry Pi camera
Running ./mjpg_streamer -o output_http.so -w ./www-octopi -n -i input_raspicam.so -fps 10
MJPG Streamer Version: git rev: 821c330ea6bbb5fbed98d48e00aac156e923161b
 i: fps.............: 10
 i: resolution........: 640 x 480
 i: camera parameters..............:

Sharpness 0, Contrast 0, Brightness 50
Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0
Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none'
Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128
Rotation 0, hflip No, vflip No
ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000
 o: www-folder-path......: ./www-octopi/
 o: HTTP TCP port........: 8080
 o: HTTP Listen Address..: (null)
 o: username:password....: disabled
 o: commands.............: disabled
 i: Starting Camera
Encoder Buffer Size 81920

#10

Joshua, what does this return?

$ vcgencmd get_mem gpu

I have a hunch.


#11

running that exactly as you typed it out i get command not found


#12
which vcgencmd
  /usr/bin/vcgencmd

Makes me wonder if the start_x.elf actually ran.


#13

If the config.txt that you gave us is verbatim, you have two lines that are comments and need to be prefixed with a comment:

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on
# enable raspicam
start_x=1
gpu_mem=128


#14

i ran sudo apt-get update and sudo apt-get -y upgrade

reviewing /var/log/webcamd.log provides this:


--- Configuration: ----------------------------
camera:        auto
usb options:   -r 640x480 -f 10
raspi options: -fps 10
http options:  -w ./www-octopi -n
-----------------------------------------------

Found video devices:
/dev/video0
USB device was not set in options, start MJPG-streamer with the first found vid$

Camera model 046d:082b is known to not work with -f parameter, stripping it out

<13>Aug 31 04:23:58 pi: Starting USB webcam
Running ./mjpg_streamer -o output_http.so -w ./www-octopi -n -i input_uvc.so -r$
MJPG Streamer Version: git rev: 821c330ea6bbb5fbed98d48e00aac156e923161b
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: -1
 i: Format............: JPEG
 i: TV-Norm...........: DEFAULT
UVCIOC_CTRL_ADD - Error at Pan (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Tilt (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Pan Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Pan/tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_ADD - Error at Focus (absolute): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Pan (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Tilt (relative): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Pan Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Pan/tilt Reset: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Focus (absolute): Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at LED1 Mode: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at LED1 Frequency: Inappropriate ioctl for device (25)
UVCIOC_CTRL_MAP - Error at Disable video processing: Inappropriate ioctl for device $
UVCIOC_CTRL_MAP - Error at Raw bits per pixel: Inappropriate ioctl for device (25)
 o: www-folder-path......: ./www-octopi/
 o: HTTP TCP port........: 8080
 o: HTTP Listen Address..: (null)
 o: username:password....: disabled
 o: commands.............: disabled
Ignoring empty buffer ...
Unable to requeue buffer: No such device
 i: Error grabbing frames
<13>Aug 31 04:39:34 pi: Starting Raspberry Pi camera
Running ./mjpg_streamer -o output_http.so -w ./www-octopi -n -i input_raspicam.so -f$
MJPG Streamer Version: git rev: 821c330ea6bbb5fbed98d48e00aac156e923161b
 i: fps.............: 10
 i: resolution........: 640 x 480
 i: camera parameters..............:

Sharpness 0, Contrast 0, Brightness 50
Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0
Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none'
Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128
Rotation 0, hflip No, vflip No
ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000
 o: www-folder-path......: ./www-octopi/
 o: HTTP TCP port........: 8080
 o: HTTP Listen Address..: (null)
 o: username:password....: disabled
 o: commands.............: disabled
 i: Starting Camera
Encoder Buffer Size 81920

Goodbye...

#15

Why is it trying to load up a USB-based camera? Maybe... unplug the Logitech?

If you ignore all the errors from the USB-based camera, it looks like the Raspi Cam is happy. Try unplugging the Logitech, rebooting completely and see if the Raspi Cam is now working.


#16

i think i removed those comments for some reason, recommented the lines with no change


#17

i'm not sure, i have had a c170 plugged in yesterday to test and see if it was working correctly, but hasnt been plugged in since


#18

The timestamps looked so close. I assumed they were from the same session.


#19

haha they shouldnt be from the same session, ive rebooted the pi half a dozen times today already haha. but yeah that logitech hasnt been plugged in for a while now


#20

I think I would sudo systemctl stop octoprint to turn it off for a bit, kill mjpg_streamer with a pkill mjpg_streamer and repeat the raspistill from earlier.


Good thing I'm diligent like this: raspistill -o cam.jpg for me on a working rig produces what could be considered a false positive.

mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Failed to run camera app. Please check for firmware updates

So of course, I'm also running the upgrade...