hassio-addons / addon-motioneye

motionEye - Home Assistant Community Add-ons
https://addons.community
MIT License
267 stars 43 forks source link

Unable to open Raspberry Pi Camera #490

Closed TheLazyHatGuy closed 1 week ago

TheLazyHatGuy commented 1 month ago

Problem/Motivation

I am attempting to add a RPI Camera to motionEye, but I just get UNABLE TO OPEN VIDEO DEVICE

Expected behavior

Camera shows

Actual behavior

UNABLE TO OPEN VIDEO DEVICE

Steps to reproduce

https://gist.github.com/enegaard/a57af286205914bd912270c89650fb1b?permalink_comment_id=5088159#gistcomment-5088159

Additional info

When SSH into the container I'm able to get the following info

# docker exec -it addon_a0d7b954_motioneye bash
root@a0d7b954-motioneye:/$ for i in /dev/video* /dev/media*; do echo ====== $i ======; v4l2-ctl -ld $i; done
====== /dev/video0 ======

User Controls

                     brightness 0x00980900 (int)    : min=0 max=100 step=1 default=50 value=50 flags=slider
                       contrast 0x00980901 (int)    : min=-100 max=100 step=1 default=0 value=0 flags=slider
                     saturation 0x00980902 (int)    : min=-100 max=100 step=1 default=0 value=0 flags=slider
                    red_balance 0x0098090e (int)    : min=1 max=7999 step=1 default=1000 value=1000 flags=slider
                   blue_balance 0x0098090f (int)    : min=1 max=7999 step=1 default=1000 value=1000 flags=slider
                horizontal_flip 0x00980914 (bool)   : default=0 value=0
                  vertical_flip 0x00980915 (bool)   : default=0 value=0
           power_line_frequency 0x00980918 (menu)   : min=0 max=3 default=1 value=1 (50 Hz)
                      sharpness 0x0098091b (int)    : min=-100 max=100 step=1 default=0 value=0 flags=slider
                  color_effects 0x0098091f (menu)   : min=0 max=15 default=0 value=0 (None)
                         rotate 0x00980922 (int)    : min=0 max=360 step=90 default=0 value=0 flags=modify-layout
             color_effects_cbcr 0x0098092a (int)    : min=0 max=65535 step=1 default=32896 value=32896

Codec Controls

             video_bitrate_mode 0x009909ce (menu)   : min=0 max=1 default=0 value=0 (Variable Bitrate) flags=update
                  video_bitrate 0x009909cf (int)    : min=25000 max=25000000 step=25000 default=10000000 value=10000000
         repeat_sequence_header 0x009909e2 (bool)   : default=0 value=0
                force_key_frame 0x009909e5 (button) : value=0 flags=write-only, execute-on-write
          h264_minimum_qp_value 0x00990a61 (int)    : min=0 max=51 step=1 default=0 value=0
          h264_maximum_qp_value 0x00990a62 (int)    : min=0 max=51 step=1 default=0 value=0
            h264_i_frame_period 0x00990a66 (int)    : min=0 max=2147483647 step=1 default=60 value=60
                     h264_level 0x00990a67 (menu)   : min=0 max=13 default=11 value=11 (4)
                   h264_profile 0x00990a6b (menu)   : min=0 max=4 default=4 value=4 (High)

Camera Controls

                  auto_exposure 0x009a0901 (menu)   : min=0 max=3 default=0 value=0 (Auto Mode)
         exposure_time_absolute 0x009a0902 (int)    : min=1 max=10000 step=1 default=1000 value=1000
     exposure_dynamic_framerate 0x009a0903 (bool)   : default=0 value=0
             auto_exposure_bias 0x009a0913 (intmenu): min=0 max=24 default=12 value=12 (0 0x0)
      white_balance_auto_preset 0x009a0914 (menu)   : min=0 max=10 default=1 value=1 (Auto)
            image_stabilization 0x009a0916 (bool)   : default=0 value=0
                iso_sensitivity 0x009a0917 (intmenu): min=0 max=4 default=0 value=0 (0 0x0)
           iso_sensitivity_auto 0x009a0918 (menu)   : min=0 max=1 default=1 value=1 (Auto)
         exposure_metering_mode 0x009a0919 (menu)   : min=0 max=3 default=0 value=0 (Average)
                     scene_mode 0x009a091a (menu)   : min=0 max=13 default=0 value=0 (None)

JPEG Compression Controls

            compression_quality 0x009d0903 (int)    : min=1 max=100 step=1 default=30 value=30

and my camera config

root@a0d7b954-motioneye:/$ cat /data/motioneye/camera-1.conf
# @enabled on
# @id 1
# @storage_device custom-path
# @network_server 
# @network_share_name 
# @network_smb_ver 1.0
# @network_username 
# @network_password 
# @upload_enabled off
# @upload_picture on
# @upload_movie on
# @upload_service ftp
# @upload_server 
# @upload_port 
# @upload_method post
# @upload_location 
# @upload_subfolders on
# @upload_username 
# @upload_password 
# @upload_endpoint_url 
# @upload_access_key 
# @upload_secret_key 
# @upload_bucket 
# @clean_cloud_enabled off
# @webcam_resolution 100
# @webcam_server_resize off
# @motion_detection on
# @preserve_pictures 0
# @manual_snapshots on
# @preserve_movies 0
# @manual_record off
# @working_schedule 
# @working_schedule_type outside
# @lang en

width 320
height 200
camera_name Camera1
auto_brightness off
framerate 2
rotate 0
mask_privacy 
target_dir /share/motioneye/Camera1
stream_localhost off
stream_port 9081
stream_maxrate 5
stream_quality 85
stream_motion off
stream_auth_method 0
text_left Camera1
text_right %Y-%m-%d\n%T
text_scale 1
text_changes off
locate_motion_mode off
locate_motion_style redbox
threshold 2000
threshold_maximum 0
threshold_tune off
noise_tune on
noise_level 31
lightswitch_percent 0
despeckle_filter 
minimum_motion_frames 20
smart_mask_speed 0
mask_file 
movie_output_motion off
picture_output_motion off
pre_capture 1
post_capture 1
picture_output off
picture_filename 
emulate_motion off
event_gap 30
snapshot_interval 0
snapshot_filename 
picture_quality 85
movie_filename %Y-%m-%d/%H-%M-%S
movie_max_time 0
movie_output off
movie_passthrough off
movie_codec mp4:h264_v4l2m2m
movie_quality 75
on_event_start /usr/lib/python3.11/site-packages/motioneye/scripts/relayevent.sh "/data/motioneye/motioneye.conf" start %t
on_event_end /usr/lib/python3.11/site-packages/motioneye/scripts/relayevent.sh "/data/motioneye/motioneye.conf" stop %t
on_movie_end /usr/lib/python3.11/site-packages/motioneye/scripts/relayevent.sh "/data/motioneye/motioneye.conf" movie_end %t %f
on_picture_save /usr/lib/python3.11/site-packages/motioneye/scripts/relayevent.sh "/data/motioneye/motioneye.conf" picture_save %t %f
stream_authentication user:
video_device /dev/video0
video_params auto_exposure=0,auto_exposure_bias=12,blue_balance=1000,brightness=50,color_effects=0,color_effects_cbcr=32896,compression_quality=30,contrast=0,exposure_metering_mode=0,exposure_time_absolute=1000,h264_i_frame_period=60,h264_level=11,h264_maximum_qp_value=0,h264_minimum_qp_value=0,h264_profile=4,iso_sensitivity=0,iso_sensitivity_auto=1,power_line_frequency=1,red_balance=1000,rotate=0,saturation=0,scene_mode=0,sharpness=0,video_bitrate=10000000,video_bitrate_mode=0,white_balance_auto_preset=1
TheLazyHatGuy commented 1 month ago

Some more logs

# docker exec -it addon_a0d7b954_motioneye bash
root@a0d7b954-motioneye:/$ apk add libcamera-tools
(1/7) Installing libcamera-ipa (0.1.0-r1)
(2/7) Installing libunwind (1.7.2-r1)
(3/7) Installing yaml (0.2.5-r2)
(4/7) Installing libcamera (0.1.0-r1)
(5/7) Installing libevent (2.1.12-r7)
(6/7) Installing gtest (1.14.0-r1)
(7/7) Installing libcamera-tools (0.1.0-r1)
Executing busybox-1.36.1-r15.trigger
OK: 207 MiB in 184 packages
root@a0d7b954-motioneye:/$ cam -l
[0:14:00.070772133] [478]  INFO Camera camera_manager.cpp:284 libcamera v0.1.0
Available cameras:
root@a0d7b954-motioneye:/$ exit
# docker exec -it addon_a0d7b954_motioneye bash
root@a0d7b954-motioneye:/$ v4l2-ctl  --list-devices
bcm2835-codec-decode (platform:bcm2835-codec):
    /dev/video10
    /dev/video11
    /dev/video12
    /dev/video18
    /dev/video31
    /dev/media1

bcm2835-isp (platform:bcm2835-isp):
    /dev/video13
    /dev/video14
    /dev/video15
    /dev/video16
    /dev/video20
    /dev/video21
    /dev/video22
    /dev/video23
    /dev/media2
    /dev/media3

mmal service 16.1 (platform:bcm2835_v4l2-0):
    /dev/video0

rpivid (platform:rpivid):
    /dev/video19
    /dev/media0
TheLazyHatGuy commented 1 month ago

Looks like this is a known issue with motioneye. Workaround for when motionEye is running locally: https://github.com/motioneye-project/motioneye/issues/2812#issuecomment-1817391735

github-actions[bot] commented 2 weeks ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!