ludiazv / octocitrico

OctoPrint for other fruits
148 stars 19 forks source link

webcam doesn't work after reboot #8

Closed IvanPanchak closed 3 years ago

IvanPanchak commented 3 years ago

helo, after edit octoprint.txt (camera_usb_options="-r 1280x720 -f 10 -y"), and enabling webcam service i reboot and all work fine? but after next reboot camera dont work. Then i edit octoprint.txt (camera_usb_options="-r VGA-f 10 -y")? rebot and all work, but to next rebot. webcam logitec c310. pls help. I am noob ( webcamd.service start only one time after reboot.

ludiazv commented 3 years ago

Hi, Could provide some logs on the webcamd.service?

IvanPanchak commented 3 years ago

/var/log/webcamd.log , he is not here. where can i look at the log? journalctl -u webcamd -- Logs begin at Wed 2021-02-17 09:16:06 UTC, end at Wed 2021-02-17 09:28:42 UTC Feb 17 09:16:07 citrico-opizero systemd[1]: Starting the OctoPi webcam daemon wi Feb 17 09:16:08 citrico-opizero webcamd[619]: Starting up webcamDaemon... Feb 17 09:16:08 citrico-opizero webcamd[619]: --- Configuration: --------------- Feb 17 09:16:08 citrico-opizero webcamd[619]: cfg_file: /boot/octopi.txt Feb 17 09:16:08 citrico-opizero webcamd[619]: camera: auto Feb 17 09:16:08 citrico-opizero webcamd[619]: usb options: -r 640x480 -f 10 Feb 17 09:16:08 citrico-opizero webcamd[619]: raspi options: -fps 10 Feb 17 09:16:08 citrico-opizero webcamd[619]: http options: -w ./www-octopi -n Feb 17 09:16:08 citrico-opizero webcamd[619]: Explicitly USB device: Feb 17 09:16:08 citrico-opizero webcamd[619]: ---------------------------------- Feb 17 09:16:08 citrico-opizero webcamd[619]: /root/bin/webcamd: line 188: vcgen Feb 17 09:16:08 citrico-opizero webcamd[619]: Found video devices: Feb 17 09:16:08 citrico-opizero webcamd[619]: /dev/video0 Feb 17 09:16:08 citrico-opizero webcamd[619]: /dev/video1 Feb 17 09:16:08 citrico-opizero webcamd[619]: /dev/video2 Feb 17 09:16:08 citrico-opizero webcamd[619]: config file='/boot/octopi.txt':USB Feb 17 09:16:08 citrico-opizero webcamd[619]: /root/bin/webcamd: line 153: print Feb 17 09:16:08 citrico-opizero webcamd[619]: /root/bin/webcamd: line 153: print Feb 17 09:16:08 citrico-opizero root[708]: Starting USB webcam Feb 17 09:16:08 citrico-opizero webcamd[619]: <13>Feb 17 09:16:08 root: Starting Feb 17 09:16:08 citrico-opizero webcamd[619]: Running ./mjpgstreamer -o output Feb 17 09:16:09 citrico-opizero mjpg_streamer[723]: MJPG-streamer [723]: startin lines 1-23 octoprint.log

ludiazv commented 3 years ago

Yes journalctl must show the problem in webcamd. Octoprint will work without this service so octiprint log is not useful here. I can't see here any error on the webcamd.service. what is the status.

IvanPanchak commented 3 years ago

root@citrico-opizero:~# lsusb Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 002: ID 046d:081b Logitech, Inc. Webcam C310 Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

root@citrico-opizero:~# ls -ltrh /dev/video* crwxrwxrwx 1 root video 81, 2 Feb 17 09:42 /dev/video2 crwxrwxrwx 1 root video 81, 1 Feb 17 09:42 /dev/video0

root@citrico-opizero:~# v4l2-ctl --list-devices UVC Camera (046d:081b) (usb-1c1b000.usb-1): /dev/video0 /dev/video2 Maybe it works with the wrong camera?

IvanPanchak commented 3 years ago

[ OK ] Started the OctoPi webcam …ith the user specified config. [ OK ] Stopped the OctoPi webcam …ith the user specified config. [FAILED] Failed to start the OctoPi…ith the user specified config. See 'systemctl status webcamd.service' for details.

I get this when Opi loads

IvanPanchak commented 3 years ago

sudo ffmpeg -f v4l2 -pixel_format yuyv422 -s 1280x720 -i /dev/video1 output.wmv

the camera will turn on when I run this command

ludiazv commented 3 years ago

have you test manually on which /dev/videoX the camera works? Does it change in every boot? If not you can provide the "-d /dev/videoX" in octopi.txt in usb parameters this will force the service to use the device. Also set camera="usb" then you avoid the script to test for raspi cams that do not apply in your context.

IvanPanchak commented 3 years ago

camera="usb" - I did it before, it didn't work

camera_usb_options="-d /dev/video1 -r 1280x720 -f 10" - did so and the camera began to run with the system , everything worked, very grateful!