SonicPad-Debian icon indicating copy to clipboard operation
SonicPad-Debian copied to clipboard

creality nebula camera

Open bhast2 opened this issue 1 year ago • 44 comments

Got everything installed and working but I can't get my nebula camera to work. I have tried everything I can think of to make it work. It shows that it is connected, and it sees the camera but can't get video to show. I plug in a different camera, and it works perfect. Any help on this would be great. Thank you

bhast2 avatar Feb 25 '24 14:02 bhast2

I have this issue as well

Brakisshuro avatar Feb 28 '24 01:02 Brakisshuro

Try changing the Camera Url Stream to: http:// your IP address /webcam/?action=stream** and/or the Stream type: to MJPEG Stream

sahuddy avatar Feb 28 '24 02:02 sahuddy

Try changing the Camera Url Stream to: http:///webcam/?action=stream and/or the Stream type: to MJPEG Stream

I have tried all the combos I can, when I try to access via the pad, is says "failed to open http://120.0.0.1/webcam/?action=stream"

on fluid, it is just a sliver of the screen.

Brakisshuro avatar Feb 28 '24 02:02 Brakisshuro

You are trying to use the system loopback address, which is actually 127.0.0.1, but I meant use the IP address that the pad is using.

sahuddy avatar Feb 28 '24 02:02 sahuddy

You are trying to use the system loopback address, which is actually 127.0.0.1, but I meant use the IP address that the pad is using.

Nginx bad gateway 502

Brakisshuro avatar Feb 28 '24 02:02 Brakisshuro

What does the [timelapse] stanza look like in moonraker.conf? Also, are you using crowsnest?

sahuddy avatar Feb 28 '24 02:02 sahuddy

What does the [timelapse] stanza look like in moonraker.conf? Also, are you using crowsnest?

[timelapse] output_path: /home/sonic/printer_data/timelapse/ frame_path: /home/sonic/printer_data/frames/ ffmpeg_binary_path: /opt/bin/ffmpeg snapshoturl: http://localhost:8080/?action=snapshot

Yes crowsnest is installed.

Brakisshuro avatar Feb 28 '24 02:02 Brakisshuro

Thanks. That all looks right, so I'm out of ideas. Sorry.

sahuddy avatar Feb 28 '24 04:02 sahuddy

Thanks. That all looks right, so I'm out of ideas. Sorry.

That's ok, appreciate your help

Brakisshuro avatar Feb 28 '24 04:02 Brakisshuro

@Jpe230 you know of a fix for the Creality Nebula Camera perhaps? Is there something we can do about this? Thanks in advance for your help!

DDen87 avatar Mar 02 '24 10:03 DDen87

I hope a fix is found soon. What I don't understand is the camera works great on a raspberry pi with the mainsail os on raspberry pi imager.

maybe there is something in the source code that can help us if anyone wants to take a look. https://github.com/mainsail-crew/MainsailOS

bhast2 avatar Mar 03 '24 17:03 bhast2

Is the Nebula cam just a run of the mill webcam? If so I can give it a try to see if I can reproduce with a Logitech cam, otherwise I'll have to save up some money to buy one :p

Jpe230 avatar Mar 05 '24 00:03 Jpe230

@Jpe230 I have some drivers I found if you want to take a look at them. It is creality 's AI camera. It works on stock Sonic pad, and it works on pi installations of Klipper

Brakisshuro avatar Mar 05 '24 00:03 Brakisshuro

@Jpe230 here is drivers I got from another member who worked on creality up their foodchain. https://drive.google.com/file/d/1zQ3fj2bvAvJTA9mYQD4fU4kFEcTF7Mad/view?usp=sharing

Brakisshuro avatar Mar 05 '24 01:03 Brakisshuro

I managed to use the Nebula Camera, all I did was to comment this line:

https://github.com/mainsail-crew/crowsnest/blob/e96cd46ffb4a42ae1fbf23118caa68dd0dac0597/libs/ustreamer.sh#L59

The file is located at /home/sonic/crowsnest/libs/ustreamer.sh

image

FWIW my crownest conf is the following:

[crowsnest]
log_path: /home/sonic/printer_data/logs/crowsnest.log
log_level: debug                      # Valid Options are quiet/verbose/debug
delete_log: false                       # Deletes log on every restart, if set to true
no_proxy: false

[cam 1]
mode: ustreamer                         # ustreamer - Provides mjpg and snapshots. (All devices)
port: 8080                              # HTTP/MJPG Stream/Snapshot Port
device: /dev/video0                     # See Log for available ...
resolution: 1280x720                    # widthxheight format
max_fps: 30                             # If Hardware Supports this it will be forced, otherwise ignored/coerced.
#custom_flags:                          # You can run the Stream Services with custom flags.
#v4l2ctl:                               # Add v4l2-ctl parameters to setup your camera, see Log what your cam is capable of.

Jpe230 avatar Mar 08 '24 22:03 Jpe230

@Jpe230 as I'm quite new to software and Klipper. How do I get to that file? Do I use terminal (on my Mac)? Or can I reach it from the mainsail frontend of the sonic pad? I can only see these files in mainsail: image

DDen87 avatar Mar 09 '24 12:03 DDen87

Here is my ustreamer.sh best way to edit this is use a program like winscp or something like it. Below is the code that I am using for ustreamer.sh. 

#!/bin/bash

#### ustreamer library

#### crowsnest - A webcam Service for multiple Cams and Stream Services.
####
#### Written by Stephan Wendel aka KwadFan <[email protected]>
#### Copyright 2021
#### https://github.com/mainsail-crew/crowsnest
####
#### This File is distributed under GPLv3
####

# shellcheck enable=require-variable-braces

# Exit upon Errors
set -Ee

run_mjpg() {
    local cams
    v4l2_control
    cams="${1}"
    for instance in ${cams} ; do
        run_ustreamer "${instance}" &
    done
    blockyfix
    brokenfocus "${cams}"
    return
}

run_ustreamer() {
    local cam_sec ust_bin dev pt res fps cstm start_param
    cam_sec="${1}"
    # shellcheck disable=SC2153
    ust_bin="${UST_BIN}"
    dev="$(get_param "cam ${cam_sec}" device)"
    pt="$(get_param "cam ${cam_sec}" port)"
    res="$(get_param "cam ${cam_sec}" resolution)"
    fps="$(get_param "cam ${cam_sec}" max_fps)"
    cstm="$(get_param "cam ${cam_sec}" custom_flags 2> /dev/null)"
    noprx="$(get_param "crowsnest" no_proxy 2> /dev/null)"
    # construct start parameter
    if [[ -n "${noprx}" ]] && [[ "${noprx}" = "true" ]]; then
        start_param=( --host 0.0.0.0 -p "${pt}" )
        log_msg "INFO: Set to 'no_proxy' mode! Using 0.0.0.0 !"
    else
        start_param=( --host 127.0.0.1 -p "${pt}" )
    fi

    #Raspicam Workaround
    if [[ "${dev}" = "$(dev_is_legacy)" ]]; then
        start_param+=( -m MJPEG --device-timeout=5 --buffers=3 )
    else
        # Add device
        start_param+=( -d "${dev}" --device-timeout=2 )

        # Use MJPEG Hardware encoder if possible
       # if [ "$(detect_mjpeg "${cam_sec}")" = "1" ]; then
           # start_param+=( -m MJPEG --encoder=HW )
       # fi
    fi

    # set max framerate
    start_param+=( -r "${res}" -f "${fps}" )

    # webroot & allow crossdomain requests
    start_param+=( --allow-origin=\* --static "${BASE_CN_PATH}/ustreamer-www" )
    # Custom Flag Handling (append to defaults)
    if [[ -n "${cstm}" ]]; then
        start_param+=( "${cstm}" )
    fi
    # Log start_param
    log_msg "Starting ustreamer with Device ${dev} ..."
    echo "Parameters: ${start_param[*]}" | \
    log_output "ustreamer [cam ${cam_sec}]"
    # Start ustreamer
    echo "${start_param[*]}" | xargs "${ust_bin}" 2>&1 | \
    log_output "ustreamer [cam ${cam_sec}]"
    # Should not be seen else failed.
    log_msg "ERROR: Start of ustreamer [cam ${cam_sec}] failed!"
}

bhast2 avatar Mar 09 '24 15:03 bhast2

@bhast2 Thanks! I'm in. I have copied in your complete file. But still no image. I copied in @Jpe230 his crowsnest.conf.

Can you maybe share your crowsnest.conf? Can you also share you settings of the webcam and on what usb port you have it connected?

Thanks in advance (And of course so far, couldn't have come so far with this without you guys!)!

P.s. I used Cyberduck (if anybody with a Mac is interested.... )

DDen87 avatar Mar 09 '24 17:03 DDen87

@bhast2 Thanks! I'm in. I have copied in your complete file. But still no image. I copied in @Jpe230 his crowsnest.conf.

Can you maybe share your crowsnest.conf? Can you also share you settings of the webcam and on what usb port you have it connected?

Thanks in advance (And of course so far, couldn't have come so far with this without you guys!)!

P.s. I used Cyberduck (if anybody with a Mac is interested.... )

Have you replaced the file under the path I previously mentioned? If so try rebooting the pad or restart the crownest service.

I don't think that the USB port matters, but I'm connecting the cam to the bottom port at the side of the pad.

If you still have problems please share your crownest logs :)

Jpe230 avatar Mar 09 '24 17:03 Jpe230

@Jpe230 as I wasn't sure I installed everything correctly I reinstalled crows nest, and I saw this come by:

Checking if device is a Raspberry Pi ...

Checking if device is a Raspberry Pi ... [FAILED]
This device is not a Raspberry Pi therefore camera-streeamer cannot be installed ...

But I'm going the retry and uncomment line 57 in de streamer.sh file in the libs folder. And copy in your crows nest config. See what happens.

DDen87 avatar Mar 09 '24 17:03 DDen87

Yup that's expected, the pi uses camera-streamer for its backend service, and apparently it is only compatible with Pis, that why we are falling back to ustreamer ;)

Jpe230 avatar Mar 09 '24 17:03 Jpe230

Hahahaha I just wanted to double check! As I'm not that good with software...

DDen87 avatar Mar 09 '24 17:03 DDen87

@Jpe230 unfortunately did not help. See attached the crows nest log file. Thanks again for taking a look! crowsnest.log

DDen87 avatar Mar 09 '24 17:03 DDen87

IMG_8651

DDen87 avatar Mar 09 '24 17:03 DDen87

@bhast2 Thanks! I'm in. I have copied in your complete file. But still no image. I copied in @Jpe230 his crowsnest.conf.

Can you maybe share your crowsnest.conf? Can you also share you settings of the webcam and on what usb port you have it connected?

Thanks in advance (And of course so far, couldn't have come so far with this without you guys!)!

P.s. I used Cyberduck (if anybody with a Mac is interested.... )

I didn't change anything in my crowsnest.conf I just commented out those lines in the ustreamer file and it started working

bhast2 avatar Mar 09 '24 18:03 bhast2

Make sure you have MJPEG STREAM selected. and use the following for your url info

Camera URL Stream /webcam/?action=stream Camera URL SnapShot /webcam/?action=snapshot

bhast2 avatar Mar 09 '24 18:03 bhast2

Boom, I got it working!, Thank you gentlemen!

Brakisshuro avatar Mar 09 '24 19:03 Brakisshuro

@bhast2 Ok, I reinstalled crowsnest again(this time via the repo instead of via kiauh). Changed only the ustreamer.sh file. Added a webcam (the correct URL were already filled in by default). But still nothing... well something... a white screen... image

DDen87 avatar Mar 10 '24 17:03 DDen87

@bhast2 Ok, I reinstalled crowsnest again(this time via the repo instead of via kiauh). Changed only the ustreamer.sh file. Added a webcam (the correct URL were already filled in by default). But still nothing... well something... a white screen... image

I installed it thru kiauh. I have the camera plugged into the usb port

bhast2 avatar Mar 10 '24 18:03 bhast2

@bhast2 Ok, I reinstalled crowsnest again(this time via the repo instead of via kiauh). Changed only the ustreamer.sh file. Added a webcam (the correct URL were already filled in by default). But still nothing... well something... a white screen... !

Make sure you change the config file also

[crowsnest]
log_path: /home/sonic/printer_data/logs/crowsnest.log
log_level: debug                      # Valid Options are quiet/verbose/debug
delete_log: false                       # Deletes log on every restart, if set to true
no_proxy: false

[cam 1]
mode: ustreamer                         # ustreamer - Provides mjpg and snapshots. (All devices)
port: 8080                              # HTTP/MJPG Stream/Snapshot Port
device: /dev/video0                     # See Log for available ...
resolution: 1280x720                    # widthxheight format
max_fps: 30                             # If Hardware Supports this it will be forced, otherwise ignored/coerced.
#custom_flags:                          # You can run the Stream Services with custom flags.
#v4l2ctl:                               # Add v4l2-ctl parameters to setup your camera, see Log what your cam is capable of.

bhast2 avatar Mar 10 '24 18:03 bhast2