mainsail-crew / crowsnest

Webcam Service for multiple Cams
GNU General Public License v3.0
324 stars 77 forks source link

Ustreamer fails to start automatically #39

Closed sshantt closed 2 years ago

sshantt commented 2 years ago

What happened

Ustreamer fails to start automatically

[09/23/22 10:04:46] crowsnest: INFO: No usable CSI Devices found.
[09/23/22 10:04:46] crowsnest: V4L2 Control:
[09/23/22 10:04:46] crowsnest: No parameters set for [cam 1]. Skipped.
[09/23/22 10:04:47] crowsnest: INFO: Blockyfix: Setting video_bitrate_mode to constant.
[09/23/22 10:04:47] crowsnest: Try to start configured Cams / Services...
[09/23/22 10:04:48] crowsnest: INFO: Configuration of Section [cam 1] looks good. Continue...
[09/23/22 10:04:48] crowsnest: Starting ustreamer with Device /dev/video0 ...
[09/23/22 10:04:49] crowsnest: ERROR: Start of ustreamer [cam 1] failed!
[09/23/22 10:04:50] crowsnest: ... Done!

What did you expect to happen

Stream to start automatically

How to reproduce

Install crowsnest, reboot

Additional information

Running ustreamer from the bin directory manually works just fine

ustreamer git:(master) ./ustreamer --device=/dev/video0 -r 1920x1080 --device-timeout=8 --quality 100 --format=MJPEG --host=0.0.0.0 --port=8080 -f 30
-- INFO  [327.915      main] -- Using internal blank placeholder
-- INFO  [327.916      main] -- Listening HTTP on [0.0.0.0]:8080
-- INFO  [327.916    stream] -- Using V4L2 device: /dev/video0
-- INFO  [327.916    stream] -- Using desired FPS: 30
-- INFO  [327.917      http] -- Starting HTTP eventloop ...
================================================================================
-- INFO  [327.918    stream] -- Device fd=8 opened
-- INFO  [327.918    stream] -- Using input channel: 0
-- INFO  [327.919    stream] -- Using resolution: 1920x1080
-- INFO  [327.920    stream] -- Using pixelformat: MJPEG
-- INFO  [327.920    stream] -- Using HW FPS: 30
-- ERROR [327.920    stream] -- Device does not support setting of HW encoding quality parameters
-- INFO  [327.920    stream] -- Using IO method: MMAP
-- INFO  [327.933    stream] -- Requested 5 device buffers, got 5
-- INFO  [329.086    stream] -- Capturing started
-- INFO  [329.087    stream] -- Switching to HW encoder: the input is (M)JPEG ...
-- INFO  [329.087    stream] -- Using JPEG quality: encoder default
-- INFO  [329.087    stream] -- Creating pool JPEG with 1 workers ...
-- INFO  [329.087    stream] -- Capturing ...
KwadFan commented 2 years ago

Could you please attach the full log, or better set to log_level: debug and try to reproduce?

Regards Kwad

sshantt commented 2 years ago
[10/04/22 08:01:41] crowsnest: crowsnest - A webcam Service for multiple Cams and Stream Services.
[10/04/22 08:01:42] crowsnest: Version: v3.0.3-1-gee59a12
[10/04/22 08:01:42] crowsnest: Prepare Startup ...
[10/04/22 08:01:42] crowsnest: INFO: Host information:
[10/04/22 08:01:42] crowsnest: Host Info: Distribution: Raspbian GNU/Linux 10 (buster)
[10/04/22 08:01:42] crowsnest: Host Info: Release: MainsailOS release 0.6.1 (buster)
[10/04/22 08:01:42] crowsnest: Host Info: Kernel: Linux 5.15.56-v7+ armv7l
[10/04/22 08:01:42] crowsnest: Host Info: Model: Raspberry Pi 3 Model B Rev 1.2
[10/04/22 08:01:42] crowsnest: Host Info: Available CPU Cores: 4
[10/04/22 08:01:42] crowsnest: Host Info: Available Memory: 761956 kB
[10/04/22 08:01:42] crowsnest: Host Info: Diskspace (avail. / total): 106G / 118G
[10/04/22 08:01:42] crowsnest: INFO: Checking Dependencys
[10/04/22 08:01:43] crowsnest: Dependency: 'crudini' found in /usr/bin/crudini.
[10/04/22 08:01:43] crowsnest: Dependency: 'find' found in /usr/bin/find.
[10/04/22 08:01:43] crowsnest: Dependency: 'logger' found in /usr/bin/logger.
[10/04/22 08:01:43] crowsnest: Dependency: 'xargs' found in /usr/bin/xargs.
[10/04/22 08:01:43] crowsnest: Dependency: 'ffmpeg' found in /usr/bin/ffmpeg.
[10/04/22 08:01:43] crowsnest: Dependency: 'ustreamer' found in bin/ustreamer/ustreamer.
[10/04/22 08:01:43] crowsnest: Dependency: 'rtsp-simple-server' found in bin/rtsp-simple-server/rtsp-simple-server.
[10/04/22 08:01:44] crowsnest: Version Control: ustreamer is up to date. (v4.13)
[10/04/22 08:01:45] crowsnest: Version Control: rtsp-simple-server is up to date. (v0.19.1)
[10/04/22 08:01:48] crowsnest: Version Control: ffmpeg is up to date. (4.1.9-0+deb10u1+rpt1)
[10/04/22 08:01:48] crowsnest: INFO: Print Configfile: '/home/pi/klipper_config/crowsnest.conf'
[10/04/22 08:01:48] crowsnest:      [crowsnest]
[10/04/22 08:01:48] crowsnest:      log_path: ~/klipper_logs/crowsnest.log
[10/04/22 08:01:48] crowsnest:      log_level: verbose
[10/04/22 08:01:48] crowsnest:      delete_log: true
[10/04/22 08:01:48] crowsnest:      
[10/04/22 08:01:48] crowsnest:      [cam 1]
[10/04/22 08:01:48] crowsnest:      mode: mjpg
[10/04/22 08:01:48] crowsnest:      port: 8080
[10/04/22 08:01:49] crowsnest:      device: /dev/video0
[10/04/22 08:01:49] crowsnest:      resolution: 1920 x 1080
[10/04/22 08:01:49] crowsnest:      max_fps: 30
[10/04/22 08:01:49] crowsnest: INFO: Detect available Devices
[10/04/22 08:01:49] crowsnest: INFO: Found 1 total available Device(s)
[10/04/22 08:01:49] crowsnest: Detected 'Raspicam' Device -> /dev/video0
[10/04/22 08:01:49] crowsnest: Supported Formats:
[10/04/22 08:01:49] crowsnest:      [0]: 'YU12' (Planar YUV 4:2:0)
[10/04/22 08:01:49] crowsnest:      Size: Stepwise 32x32 - 4056x3040 with step 2/2
[10/04/22 08:01:49] crowsnest:      [1]: 'YUYV' (YUYV 4:2:2)
[10/04/22 08:01:49] crowsnest:      Size: Stepwise 32x32 - 4056x3040 with step 2/2
[10/04/22 08:01:49] crowsnest:      [2]: 'RGB3' (24-bit RGB 8-8-8)
[10/04/22 08:01:49] crowsnest:      Size: Stepwise 32x32 - 4056x3040 with step 2/2
[10/04/22 08:01:49] crowsnest:      [3]: 'JPEG' (JFIF JPEG, compressed)
[10/04/22 08:01:49] crowsnest:      Size: Stepwise 32x32 - 4056x3040 with step 2/2
[10/04/22 08:01:49] crowsnest:      [4]: 'H264' (H.264, compressed)
[10/04/22 08:01:49] crowsnest:      Size: Stepwise 32x32 - 4056x3040 with step 2/2
[10/04/22 08:01:49] crowsnest:      [5]: 'MJPG' (Motion-JPEG, compressed)
[10/04/22 08:01:49] crowsnest:      Size: Stepwise 32x32 - 4056x3040 with step 2/2
[10/04/22 08:01:50] crowsnest:      [6]: 'YVYU' (YVYU 4:2:2)
[10/04/22 08:01:50] crowsnest:      Size: Stepwise 32x32 - 4056x3040 with step 2/2
[10/04/22 08:01:50] crowsnest:      [7]: 'VYUY' (VYUY 4:2:2)
[10/04/22 08:01:50] crowsnest:      Size: Stepwise 32x32 - 4056x3040 with step 2/2
[10/04/22 08:01:50] crowsnest:      [8]: 'UYVY' (UYVY 4:2:2)
[10/04/22 08:01:50] crowsnest:      Size: Stepwise 32x32 - 4056x3040 with step 2/2
[10/04/22 08:01:50] crowsnest:      [9]: 'NV12' (Y/CbCr 4:2:0)
[10/04/22 08:01:50] crowsnest:      Size: Stepwise 32x32 - 4056x3040 with step 2/2
[10/04/22 08:01:50] crowsnest:      [10]: 'BGR3' (24-bit BGR 8-8-8)
[10/04/22 08:01:50] crowsnest:      Size: Stepwise 32x32 - 4056x3040 with step 2/2
[10/04/22 08:01:50] crowsnest:      [11]: 'YV12' (Planar YVU 4:2:0)
[10/04/22 08:01:50] crowsnest:      Size: Stepwise 32x32 - 4056x3040 with step 2/2
[10/04/22 08:01:50] crowsnest:      [12]: 'NV21' (Y/CrCb 4:2:0)
[10/04/22 08:01:50] crowsnest:      Size: Stepwise 32x32 - 4056x3040 with step 2/2
[10/04/22 08:01:50] crowsnest:      [13]: 'RX24' (32-bit XBGR 8-8-8-8)
[10/04/22 08:01:50] crowsnest:      Size: Stepwise 32x32 - 4056x3040 with step 2/2
[10/04/22 08:01:50] crowsnest: Supported Controls:
[10/04/22 08:01:50] crowsnest:      
[10/04/22 08:01:50] crowsnest:      User Controls
[10/04/22 08:01:50] crowsnest:      
[10/04/22 08:01:50] crowsnest:      brightness 0x00980900 (int) : min=0 max=100 step=1 default=50 value=50 flags=slider
[10/04/22 08:01:50] crowsnest:      contrast 0x00980901 (int) : min=-100 max=100 step=1 default=0 value=0 flags=slider
[10/04/22 08:01:50] crowsnest:      saturation 0x00980902 (int) : min=-100 max=100 step=1 default=0 value=0 flags=slider
[10/04/22 08:01:50] crowsnest:      red_balance 0x0098090e (int) : min=1 max=7999 step=1 default=1000 value=1000 flags=slider
[10/04/22 08:01:50] crowsnest:      blue_balance 0x0098090f (int) : min=1 max=7999 step=1 default=1000 value=1000 flags=slider
[10/04/22 08:01:50] crowsnest:      horizontal_flip 0x00980914 (bool) : default=0 value=0
[10/04/22 08:01:50] crowsnest:      vertical_flip 0x00980915 (bool) : default=0 value=0
[10/04/22 08:01:50] crowsnest:      power_line_frequency 0x00980918 (menu) : min=0 max=3 default=1 value=1
[10/04/22 08:01:50] crowsnest:      0: Disabled
[10/04/22 08:01:51] crowsnest:      1: 50 Hz
[10/04/22 08:01:51] crowsnest:      2: 60 Hz
[10/04/22 08:01:51] crowsnest:      3: Auto
[10/04/22 08:01:51] crowsnest:      sharpness 0x0098091b (int) : min=-100 max=100 step=1 default=0 value=50 flags=slider
[10/04/22 08:01:51] crowsnest:      color_effects 0x0098091f (menu) : min=0 max=15 default=0 value=0
[10/04/22 08:01:51] crowsnest:      0: None
[10/04/22 08:01:51] crowsnest:      1: Black & White
[10/04/22 08:01:51] crowsnest:      2: Sepia
[10/04/22 08:01:51] crowsnest:      3: Negative
[10/04/22 08:01:51] crowsnest:      4: Emboss
[10/04/22 08:01:51] crowsnest:      5: Sketch
[10/04/22 08:01:51] crowsnest:      6: Sky Blue
[10/04/22 08:01:51] crowsnest:      7: Grass Green
[10/04/22 08:01:51] crowsnest:      8: Skin Whiten
[10/04/22 08:01:51] crowsnest:      9: Vivid
[10/04/22 08:01:51] crowsnest:      10: Aqua
[10/04/22 08:01:51] crowsnest:      11: Art Freeze
[10/04/22 08:01:51] crowsnest:      12: Silhouette
[10/04/22 08:01:51] crowsnest:      13: Solarization
[10/04/22 08:01:51] crowsnest:      14: Antique
[10/04/22 08:01:51] crowsnest:      15: Set Cb/Cr
[10/04/22 08:01:51] crowsnest:      rotate 0x00980922 (int) : min=0 max=360 step=90 default=0 value=0 flags=modify-layout
[10/04/22 08:01:51] crowsnest:      color_effects_cbcr 0x0098092a (int) : min=0 max=65535 step=1 default=32896 value=32896
[10/04/22 08:01:51] crowsnest:      
[10/04/22 08:01:51] crowsnest:      Codec Controls
[10/04/22 08:01:51] crowsnest:      
[10/04/22 08:01:51] crowsnest:      video_bitrate_mode 0x009909ce (menu) : min=0 max=1 default=0 value=0 flags=update
[10/04/22 08:01:51] crowsnest:      0: Variable Bitrate
[10/04/22 08:01:51] crowsnest:      1: Constant Bitrate
[10/04/22 08:01:52] crowsnest:      video_bitrate 0x009909cf (int) : min=25000 max=25000000 step=25000 default=10000000 value=25000000
[10/04/22 08:01:52] crowsnest:      repeat_sequence_header 0x009909e2 (bool) : default=0 value=0
[10/04/22 08:01:52] crowsnest:      force_key_frame 0x009909e5 (button) : flags=write-only, execute-on-write
[10/04/22 08:01:52] crowsnest:      h264_minimum_qp_value 0x00990a61 (int) : min=0 max=51 step=1 default=0 value=0
[10/04/22 08:01:52] crowsnest:      h264_maximum_qp_value 0x00990a62 (int) : min=0 max=51 step=1 default=0 value=0
[10/04/22 08:01:52] crowsnest:      h264_i_frame_period 0x00990a66 (int) : min=0 max=2147483647 step=1 default=60 value=60
[10/04/22 08:01:52] crowsnest:      h264_level 0x00990a67 (menu) : min=0 max=13 default=11 value=11
[10/04/22 08:01:52] crowsnest:      0: 1
[10/04/22 08:01:52] crowsnest:      1: 1b
[10/04/22 08:01:52] crowsnest:      2: 1.1
[10/04/22 08:01:52] crowsnest:      3: 1.2
[10/04/22 08:01:52] crowsnest:      4: 1.3
[10/04/22 08:01:52] crowsnest:      5: 2
[10/04/22 08:01:52] crowsnest:      6: 2.1
[10/04/22 08:01:52] crowsnest:      7: 2.2
[10/04/22 08:01:52] crowsnest:      8: 3
[10/04/22 08:01:52] crowsnest:      9: 3.1
[10/04/22 08:01:52] crowsnest:      10: 3.2
[10/04/22 08:01:52] crowsnest:      11: 4
[10/04/22 08:01:52] crowsnest:      12: 4.1
[10/04/22 08:01:52] crowsnest:      13: 4.2
[10/04/22 08:01:53] crowsnest:      h264_profile 0x00990a6b (menu) : min=0 max=4 default=4 value=4
[10/04/22 08:01:53] crowsnest:      0: Baseline
[10/04/22 08:01:53] crowsnest:      1: Constrained Baseline
[10/04/22 08:01:53] crowsnest:      2: Main
[10/04/22 08:01:53] crowsnest:      4: High
[10/04/22 08:01:53] crowsnest:      
[10/04/22 08:01:53] crowsnest:      Camera Controls
[10/04/22 08:01:53] crowsnest:      
[10/04/22 08:01:53] crowsnest:      auto_exposure 0x009a0901 (menu) : min=0 max=3 default=0 value=0
[10/04/22 08:01:53] crowsnest:      0: Auto Mode
[10/04/22 08:01:53] crowsnest:      1: Manual Mode
[10/04/22 08:01:53] crowsnest:      exposure_time_absolute 0x009a0902 (int) : min=1 max=10000 step=1 default=1000 value=1000
[10/04/22 08:01:53] crowsnest:      exposure_dynamic_framerate 0x009a0903 (bool) : default=0 value=0
[10/04/22 08:01:53] crowsnest:      auto_exposure_bias 0x009a0913 (intmenu): min=0 max=24 default=12 value=12
[10/04/22 08:01:53] crowsnest:      0: -4000 (0xfffffffffffff060)
[10/04/22 08:01:53] crowsnest:      1: -3667 (0xfffffffffffff1ad)
[10/04/22 08:01:53] crowsnest:      2: -3333 (0xfffffffffffff2fb)
[10/04/22 08:01:53] crowsnest:      3: -3000 (0xfffffffffffff448)
[10/04/22 08:01:53] crowsnest:      4: -2667 (0xfffffffffffff595)
[10/04/22 08:01:53] crowsnest:      5: -2333 (0xfffffffffffff6e3)
[10/04/22 08:01:53] crowsnest:      6: -2000 (0xfffffffffffff830)
[10/04/22 08:01:53] crowsnest:      7: -1667 (0xfffffffffffff97d)
[10/04/22 08:01:53] crowsnest:      8: -1333 (0xfffffffffffffacb)
[10/04/22 08:01:53] crowsnest:      9: -1000 (0xfffffffffffffc18)
[10/04/22 08:01:53] crowsnest:      10: -667 (0xfffffffffffffd65)
[10/04/22 08:01:53] crowsnest:      11: -333 (0xfffffffffffffeb3)
[10/04/22 08:01:54] crowsnest:      12: 0 (0x0)
[10/04/22 08:01:54] crowsnest:      13: 333 (0x14d)
[10/04/22 08:01:54] crowsnest:      14: 667 (0x29b)
[10/04/22 08:01:54] crowsnest:      15: 1000 (0x3e8)
[10/04/22 08:01:54] crowsnest:      16: 1333 (0x535)
[10/04/22 08:01:54] crowsnest:      17: 1667 (0x683)
[10/04/22 08:01:54] crowsnest:      18: 2000 (0x7d0)
[10/04/22 08:01:54] crowsnest:      19: 2333 (0x91d)
[10/04/22 08:01:54] crowsnest:      20: 2667 (0xa6b)
[10/04/22 08:01:54] crowsnest:      21: 3000 (0xbb8)
[10/04/22 08:01:54] crowsnest:      22: 3333 (0xd05)
[10/04/22 08:01:54] crowsnest:      23: 3667 (0xe53)
[10/04/22 08:01:54] crowsnest:      24: 4000 (0xfa0)
[10/04/22 08:01:54] crowsnest:      white_balance_auto_preset 0x009a0914 (menu) : min=0 max=10 default=1 value=1
[10/04/22 08:01:54] crowsnest:      0: Manual
[10/04/22 08:01:54] crowsnest:      1: Auto
[10/04/22 08:01:54] crowsnest:      2: Incandescent
[10/04/22 08:01:54] crowsnest:      3: Fluorescent
[10/04/22 08:01:54] crowsnest:      4: Fluorescent H
[10/04/22 08:01:54] crowsnest:      5: Horizon
[10/04/22 08:01:54] crowsnest:      6: Daylight
[10/04/22 08:01:54] crowsnest:      7: Flash
[10/04/22 08:01:54] crowsnest:      8: Cloudy
[10/04/22 08:01:54] crowsnest:      9: Shade
[10/04/22 08:01:54] crowsnest:      10: Greyworld
[10/04/22 08:01:54] crowsnest:      image_stabilization 0x009a0916 (bool) : default=0 value=0
[10/04/22 08:01:55] crowsnest:      iso_sensitivity 0x009a0917 (intmenu): min=0 max=4 default=0 value=0
[10/04/22 08:01:55] crowsnest:      0: 0 (0x0)
[10/04/22 08:01:55] crowsnest:      1: 100000 (0x186a0)
[10/04/22 08:01:55] crowsnest:      2: 200000 (0x30d40)
[10/04/22 08:01:55] crowsnest:      3: 400000 (0x61a80)
[10/04/22 08:01:55] crowsnest:      4: 800000 (0xc3500)
[10/04/22 08:01:55] crowsnest:      iso_sensitivity_auto 0x009a0918 (menu) : min=0 max=1 default=1 value=0
[10/04/22 08:01:55] crowsnest:      0: Manual
[10/04/22 08:01:55] crowsnest:      1: Auto
[10/04/22 08:01:55] crowsnest:      exposure_metering_mode 0x009a0919 (menu) : min=0 max=3 default=0 value=0
[10/04/22 08:01:55] crowsnest:      0: Average
[10/04/22 08:01:55] crowsnest:      1: Center Weighted
[10/04/22 08:01:55] crowsnest:      2: Spot
[10/04/22 08:01:55] crowsnest:      3: Matrix
[10/04/22 08:01:55] crowsnest:      scene_mode 0x009a091a (menu) : min=0 max=13 default=0 value=0
[10/04/22 08:01:55] crowsnest:      0: None
[10/04/22 08:01:55] crowsnest:      8: Night
[10/04/22 08:01:55] crowsnest:      11: Sports
[10/04/22 08:01:55] crowsnest:      
[10/04/22 08:01:55] crowsnest:      JPEG Compression Controls
[10/04/22 08:01:55] crowsnest:      
[10/04/22 08:01:55] crowsnest:      compression_quality 0x009d0903 (int) : min=1 max=100 step=1 default=30 value=100
[10/04/22 08:01:55] crowsnest: INFO: No usable CSI Devices found.
[10/04/22 08:01:55] crowsnest: V4L2 Control:
[10/04/22 08:01:56] crowsnest: No parameters set for [cam 1]. Skipped.
[10/04/22 08:01:57] crowsnest: INFO: Blockyfix: Setting video_bitrate_mode to constant.
[10/04/22 08:01:57] crowsnest: Try to start configured Cams / Services...
[10/04/22 08:01:57] crowsnest: INFO: Configuration of Section [cam 1] looks good. Continue...
[10/04/22 08:01:58] crowsnest: Starting ustreamer with Device /dev/video0 ...
[10/04/22 08:01:59] crowsnest: ERROR: Start of ustreamer [cam 1] failed!
[10/04/22 08:01:59] crowsnest: ... Done!
KwadFan commented 2 years ago

Ok, I dont know why, it is doing that strange thing, tbh.

But, I guess it might be the device Timeout. By default I use 5 as value. See https://github.com/mainsail-crew/crowsnest/blob/ee59a12d59cb2db173a93b266c4766b853bd0364/libs/ustreamer.sh#L40

Maybe that kind of cam needs a bit more. Try custom_flags: --device-timeout=8 and see what it does... If it then starts correctly keep it :) I'll do my tests on a pi 4 4gb. maybe therefor the initialize phase is a bit shorter. If that fixes it I will bump it up.

sshantt commented 2 years ago

Resolution input has whitespaces before and after the "x". Thats what was causing the issue