• Tags
  • Documentation
  • Order
  • Register
  • Login
Duet3D Logo Duet3D
  • Tags
  • Documentation
  • Order
  • Register
  • Login

Need help installing ustreamer

Scheduled Pinned Locked Moved
General Discussion
8
135
10.8k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • undefined
    luckyflyer
    last edited by luckyflyer 28 May 2020, 22:35

    Success, I can get into ustreamer from my pc on pi's ip addr.
    @bearer, I want to say a big thank you for your help, wouldn't have been able to get there if you hadn't stepped in!!

    @gtj0 Also thanks!

    undefined 1 Reply Last reply 29 May 2020, 00:26 Reply Quote 0
    • undefined
      gtj0 @luckyflyer
      last edited by 29 May 2020, 00:26

      @luckyflyer As a reward are you going put on a show for us???

      1 Reply Last reply Reply Quote 0
      • undefined
        luckyflyer
        last edited by luckyflyer 29 May 2020, 02:58

        I can sure do that but........ murphy has made another appearance.

        I have the standalone pi working good so now its time to load ustreamer onto the Duet pi.
        The first thing I do is assign a static ip for eth0 and wlan on Duet pi, thats done new address's work.
        Next I run.

        sudo apt-get install libevent-dev libjpeg8-dev uuid-dev libbsd-dev
        

        I get an error saying cannot reach raspbianraspberrypi.org I try several times thinking that maybe the server is down. I then try one of my pi's that is dhcp and it gets on the server immediately. I don't understand this do a google for this type of problem and come up with nothing. So I disable firewall still no. I then remove the static addresses and Duet pi is now able to reach the server.
        So the above command now downloads I proceed with the install/compile with these notes I've made,

        **Check if make and gcc are already installed, if not installed install with sudo apt-get install

        Get these,
        sudo apt-get install libevent-dev libjpeg8-dev uuid-dev libbsd-dev

        Now compile ustreamer

        $ sudo git clone --depth=1 https://github.com/pikvm/ustreamer
        $ mkdir ustreamer
        $ cd ustreamer
        $ make

        check if working with
        $ ./ustreamer --help**

        When I get to make I get this error,

        pi@duet3:~/ustreamer $ make
        -- CC src/device.c
        mkdir: cannot create directory ‘build’: Permission denied
        Assembler messages:
        Fatal error: can't create build/src/device.o: No such file or directory
        make: *** [Makefile:92: build/src/device.o] Error 1
        pi@duet3:~/ustreamer $

        @bearer Can I impose on your expertise one more time.

        1 Reply Last reply Reply Quote 0
        • undefined
          luckyflyer
          last edited by luckyflyer 29 May 2020, 03:14

          Figured it out need sudo make.

          But would still like to know why I can't do updates with a static ip address.

          1 Reply Last reply Reply Quote 0
          • undefined
            luckyflyer
            last edited by 29 May 2020, 04:18

            @bearer
            Can you take a look at this. This is from the Duet pi, same problem I had with the stand alone pi that seemed to correct its self.

            -- INFO [101.021 main] -- Installing SIGINT handler ...
            -- INFO [101.021 main] -- Installing SIGTERM handler ...
            -- INFO [101.021 main] -- Ignoring SIGPIPE ...
            -- INFO [101.021 main] -- Enabling HTTP file server: /tmp/
            -- INFO [101.021 main] -- Using internal blank placeholder
            -- INFO [101.022 main] -- Listening HTTP on [0.0.0.0]:8080
            -- INFO [101.023 stream] -- Using V4L2 device: /dev/video0
            -- INFO [101.023 stream] -- Using desired FPS: 0
            -- INFO [101.024 http] -- Starting HTTP eventloop ...
            -- INFO [101.110 stream] -- Device fd=8 opened
            -- INFO [101.110 stream] -- Using input channel: 0
            -- INFO [101.110 stream] -- Using TV standard: DEFAULT
            -- INFO [101.112 stream] -- Using resolution: 640x480
            -- INFO [101.112 stream] -- Using pixelformat: YUYV
            -- INFO [101.114 stream] -- Using HW FPS: 0 -> 15 (coerced)
            -- INFO [101.117 stream] -- Requested 5 HW buffers, got 5
            -- INFO [101.119 stream] -- Capturing started
            -- INFO [101.119 stream] -- Using JPEG quality: 80%
            -- INFO [101.119 stream] -- Creating pool with 4 workers ...
            -- INFO [101.119 stream] -- Capturing ...

            pi@duet3:~ $ sudo netstat -lt4np
            Active Internet connections (only servers)
            Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
            tcp 0 0 0.0.0.0:5900 0.0.0.0:* LISTEN 437/vncserver-x11-c
            tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1355/./ustreamer
            tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 448/sshd
            tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 353/cupsd
            pi@duet3:~ $

            I have rebooted but that doesn't seem to have helped.

            1 Reply Last reply Reply Quote 0
            • undefined
              luckyflyer
              last edited by 29 May 2020, 04:32

              I've rebooted again and now is working, temperamental little sob, quitting for the night.

              1 Reply Last reply Reply Quote 0
              • undefined
                luckyflyer
                last edited by 29 May 2020, 05:03

                Also wanted to ask is there a security risk when using 0.0.0.0:8080

                ? 1 Reply Last reply 29 May 2020, 05:56 Reply Quote 0
                • ?
                  A Former User @luckyflyer
                  last edited by 29 May 2020, 05:56

                  @luckyflyer re security risk, there is always a risk with opening network services, but if you need to access the stream from a device other than the pi, then you don't have much choice in opening up. you could bind to a specific IP address instead of 0.0.0.0 but imho it won't increase the security of the setup, only reduce the convenience. also 0.0.0.0 will work even with wired and wireless networks on the Pi, and every address a dhcp server may allocate the pi in the future.

                  re temperamental, using systemd to start and restart it as needed will probably take care of the availability of the process.

                  1 Reply Last reply Reply Quote 0
                  • undefined
                    luckyflyer
                    last edited by luckyflyer 29 May 2020, 17:31

                    @gtj0
                    Can you share your Duetlapse start script with me.
                    Thanks

                    undefined 1 Reply Last reply 29 May 2020, 18:58 Reply Quote 0
                    • undefined
                      gtj0 @luckyflyer
                      last edited by 29 May 2020, 18:58

                      @luckyflyer

                      The following 2 files will run ustreamer anytime the camera (/dev/video0) is plugged in.

                      /etc/udev/rules.d/80-ustreamer.rules:

                      KERNEL=="video0", SUBSYSTEM=="video4linux", TAG+="systemd", ENV{SYSTEMD_WANTS}+="ustreamer@%k.service"
                      

                      /etc/systemd/system/ustreamer@.service:

                      [Unit]
                      Description=UStreamer for video0
                      [Service]
                      Type=simple
                      ExecStart=/usr/local/bin/ustreamer -r 640x480 --static /tmp/ --encoder=HW -m JPEG -d /dev/%i --host=0.0.0.0 --port=8080
                      [Install]
                      WantedBy=multi-user.target

                      Reboot after copying both files to their destinations.

                      Here's the command line to start DuetLapse and pull from ustreamer:

                      ./DuetLapse.py -camera web -weburl http://localhost:8080/stream -duet localhost -seconds 5 -detect none
                      

                      Obviously you have to customize that command line. It just captures an image every 5 seconds.

                      If you need to auto-start it as well, you may have to contact @Danal . I can't seem to get it to run as a systemd service.

                      ? 1 Reply Last reply 30 May 2020, 00:34 Reply Quote 0
                      • undefined
                        luckyflyer
                        last edited by 29 May 2020, 21:47

                        @gtj0 Thanks for that.

                        1 Reply Last reply Reply Quote 0
                        • undefined
                          luckyflyer
                          last edited by luckyflyer 29 May 2020, 22:34

                          @gtj0
                          Having trouble executing the file,

                          /etc/udev/rules.d/80-ustreamer.rules:
                          

                          I get this,

                          pi@duet3:~ $ /etc/udev/rules.d/80-ustreamer.rules:
                          -bash: /etc/udev/rules.d/80-ustreamer.rules:: No such file or directory

                          I have also tried in

                          pi@duet3:~/ustreamer $
                          

                          and get the same error
                          I also tried with sudo first but got errors.

                          I haven't tried the second command yet.

                          The command line to start Duetlapse I understand.

                          Unfortunately your trying to help a linux dummy
                          undefined 1 Reply Last reply 29 May 2020, 23:25 Reply Quote 0
                          • undefined
                            gtj0 @luckyflyer
                            last edited by gtj0 29 May 2020, 23:25

                            @luckyflyer The two files I posted aren't meant to be executed. You just need to save them with the path's indicated and reboot.
                            The system automatically reads the rules files at boot and any time after that when it detects that /dev/video0 is present, it'll automatically start the ustreamer service.

                            1 Reply Last reply Reply Quote 0
                            • undefined
                              luckyflyer
                              last edited by luckyflyer 30 May 2020, 00:02

                              Well I guess I need to admit I don't know how to save a file in linux. I googled "how to save a file with raspbian command line" but they talk more about editing files. Can you give me the exact syntax for saving these files.

                              Looks like an editor like nano may be the way to save files, trying to figure it out.

                              1 Reply Last reply Reply Quote 0
                              • ?
                                A Former User @gtj0
                                last edited by A Former User 30 May 2020, 00:34

                                @gtj0 said in Need help installing ustreamer:

                                /etc/udev/rules.d/80-ustreamer.rules

                                so run sudoedit /etc/udev/rules.d/80-ustreamer.rules and paste

                                KERNEL=="video0", SUBSYSTEM=="video4linux", TAG+="systemd", ENV{SYSTEMD_WANTS}+="ustreamer@%k.service"

                                into it. hit ctr + x to exit the editor (say yes to save on your way out)*.

                                similar for /etc/systemd/system/ustreamer@.service

                                *) edit: this assumes the default EDITOR enviornment variable is set to nano, but if you've changed it you probably know how to use the editor:)

                                1 Reply Last reply Reply Quote 0
                                • undefined
                                  luckyflyer
                                  last edited by 30 May 2020, 00:44

                                  Thank you sir.

                                  1 Reply Last reply Reply Quote 0
                                  • undefined
                                    luckyflyer
                                    last edited by luckyflyer 30 May 2020, 02:16

                                    @gtj0 ,
                                    I have both files entered and saved, rebooted but am unable to log onto http://0.0.0.0:8080 or my printers address http://192.168.0.181:8080. I've double checked that everything is correct, I removed "--encoder=HW and -m JPEG" from /etc/systemd/system/ustreamer@.service: since they don't apply to my camera. But have tried it with and without those two items.
                                    It starts up ok if I use the start script.

                                    1 Reply Last reply Reply Quote 0
                                    • undefined
                                      luckyflyer
                                      last edited by 30 May 2020, 03:49

                                      This happens when I try to start the service manually,

                                      pi@duet3:~ $ sudo systemctl start ustreamer@.service
                                      Failed to start ustreamer@.service: Unit name ustreamer@.service is missing the instance name.
                                      1 Reply Last reply Reply Quote 0
                                      • ?
                                        A Former User
                                        last edited by 30 May 2020, 06:38

                                        @luckyflyer said in Need help installing ustreamer:

                                        sudo systemctl start ustreamer@.service

                                        this seems to be a so called template service, so it needs the name in the invocation; sudo systemctl start ustreamer@video0.service

                                        which probably means Description=UStreamer for video0 should be changed to Description=UStreamer for %I but doesn't affect the issue at hand I believe.

                                        1 Reply Last reply Reply Quote 0
                                        • undefined
                                          gtj0
                                          last edited by 30 May 2020, 14:42

                                          @luckyflyer Yeah sorry about that. I should have given more compete instructions. @bearer is correct about being a template service and has the correct command line to manually start and stop the service.

                                          I don't see (or don't remember) whether the camera you're using is a USB cam or a MIPI cam directly attached to the Pi's camera connector. If it's a USB camera, then here are updated service and rules files that will automatically stop the service when the device disconnects..

                                          /etc/udev/rules.d/80-ustreamer.rules:

                                          ACTION=="add", KERNEL=="video0", SUBSYSTEM=="video4linux", TAG+="systemd", ENV{SYSTEMD_WANTS}+="ustreamer@%k.service"
                                          ACTION=="remove", KERNEL=="video0", SUBSYSTEM=="video4linux", RUN+="/bin/systemctl --no-block stop ustreamer@%k.service"

                                          /etc/systemd/system/ustreamer@.service:

                                          [Unit]
                                          Description=UStreamer for %I
                                          [Service]
                                          Type=simple
                                          ExecStart=/usr/local/bin/ustreamer --exit-on-parent-death -r 640x480 --static /tmp/ -d /dev/%i --host=0.0.0.0 --port=8080
                                          [Install]
                                          WantedBy=multi-user.target

                                          As a reminder... "0.0.0.0" is a special IP address that tells server software to listen for connections on all ip addresses on the system. It can never be used to actually connect to anything.

                                          ? 1 Reply Last reply 30 May 2020, 14:50 Reply Quote 0
                                          54 out of 135
                                          • First post
                                            54/135
                                            Last post
                                          Unless otherwise noted, all forum content is licensed under CC-BY-SA