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

    DuetLapse available for Alpha testing

    Scheduled Pinned Locked Moved
    Third-party software
    26
    239
    23.3k
    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.
    • Danalundefined
      Danal
      last edited by Danal

      pi@duet3:~/DuetLapse $ ./DuetLapse.py -h
      usage: DuetLapse.py [-h] -duet DUET [-camera {usb,pi,web,dslr}]
                          [-seconds SECONDS] [-detect {layer,pause,none}]
                          [-pause {yes,no}] [-movehead MOVEHEAD MOVEHEAD]
                          [-weburl WEBURL] [-dontwait]
                          {camparms,vidparms} ...
      
      Program to create time lapse video from camera pointed at Duet3D based
      printer.
      
      optional arguments:
        -h, --help            show this help message and exit
        -duet DUET            Name or IP address of Duet printer.
        -camera {usb,pi,web,dslr}
        -seconds SECONDS
        -detect {layer,pause,none}
        -pause {yes,no}
        -movehead MOVEHEAD MOVEHEAD
        -weburl WEBURL
        -dontwait             Capture images immediately.
      
      subcommands:
        {camparms,vidparms}   DuetLapse camparms -h or vidparms -h for more help
      
      pi@duet3:~/DuetLapse $ ./DuetLapse.py camparms -h
      usage: DuetLapse.py camparms [-h] [-- ...]
      
      camparm -parms xxx where xxx is passed to fswebcam, raspistill, or wget.
      
      pi@duet3:~/DuetLapse $ ./DuetLapse.py vidparms -h
      usage: DuetLapse.py vidparms [-h] [-- ...]
      
      vidparms -parms xxx where xxx is passed to ffmpeg.
      
      pi@duet3:~/DuetLapse $
      

      Delta / Kossel printer fanatic

      1 Reply Last reply Reply Quote 0
      • PaulHewundefined
        PaulHew
        last edited by

        @Danal I have been using your tool for a week now and there is one thing which would be nice.
        I have to log into the Pi to send the DuetLapse.py -camera pi - detect layer -duet 192.168.0.7
        All this Pi does is run the TimeLapse software.

        When it has finished I have to log back in again and do it all again.

        Is there a way that it can run all of the time as a service and maybe send a telnet command from the Duet to say,
        I am about to print, get ready!!
        i.e. M118 P4 S"Print Starting"

        Which in turn enables DuetLapse with the users setting.

        Just a thought

        Regards,
        Paul.

        RailCore II - Duet Mini + 1LC, Voron V0.1 - Duet Mini
        Voron 2.4 disassembled..... Waiting for the RailCore Mini....

        1 Reply Last reply Reply Quote 0
        • Danalundefined
          Danal
          last edited by

          I will think about a way to do this... while minimally banging on the printer between prints.

          Delta / Kossel printer fanatic

          1 Reply Last reply Reply Quote 0
          • PaulHewundefined
            PaulHew
            last edited by

            Had a Malloc error, used all default settings.

            Capturing frame   522 at X10.00 Y280.00 Z120.00
            
            Now making 523 frames into a video at 10 frames per second.
            This can take a while...
            x264 [error]: malloc of size 25549312 failed
            Video encoding failed
            Killed
            Video processing complete.
            Video file is in home directory, named ~/DuetLapse0413200101.mp4
            
            

            😞 Was looking forward to this TimeLapse

            RailCore II - Duet Mini + 1LC, Voron V0.1 - Duet Mini
            Voron 2.4 disassembled..... Waiting for the RailCore Mini....

            1 Reply Last reply Reply Quote 0
            • Danalundefined
              Danal
              last edited by

              As long as you have NOT started the overall script again, or rebooted, the images are still there and you can try to make the video over and over.

              The actual command issued is:

              ffmpeg -r 10 -i /tmp/DuetLapse/IMG%08d.jpeg -vcodec libx264 -y -v 8 ~/DuetLapse0413200101.mp4

              You could try other ffmpeg options (I am not an expert), try making two videos out of half the images, and stitch the vids together later, etc, etc.

              To be clear, the images are in /tmp and are named

              IMG00000001.jpeg
              IMG00000002.jpeg

              Etc.

              Delta / Kossel printer fanatic

              1 Reply Last reply Reply Quote 0
              • mrwulffundefined
                mrwulff
                last edited by

                Awesome program. One issue I've always had is that my wifi and or duet do not like each other and disconnect constantly, but will always reconnect eventually. Is it possible to automatically 'skip' a frame if there is no connection to the printer at that time and not to throw an error?

                Also would be nice if it looked at the file name it was printing and made subfolders with the name of the print

                Danalundefined 1 Reply Last reply Reply Quote 0
                • Danalundefined
                  Danal @mrwulff
                  last edited by

                  @mrwulff said in DuetLapse available for Alpha testing:

                  Awesome program. One issue I've always had is that my wifi and or duet do not like each other and disconnect constantly, but will always reconnect eventually. Is it possible to automatically 'skip' a frame if there is no connection to the printer at that time and not to throw an error?

                  Yes, I will add some error handling to the key spots.

                  Also would be nice if it looked at the file name it was printing and made subfolders with the name of the print

                  Hey, great idea!

                  Delta / Kossel printer fanatic

                  1 Reply Last reply Reply Quote 0
                  • Baenwortundefined
                    Baenwort @Danal
                    last edited by

                    @Danal does DuetLapse require RRF3 or a certain version or above of DWC?

                    I'm interested in trying it.by I don't know.what you mean by the step that says to place the DuetLapseAPI.Ph in the python libpath? Is it enough to place all the .py files in one directory?

                    1 Reply Last reply Reply Quote 0
                    • Danalundefined
                      Danal
                      last edited by

                      @Baenwort said in DuetLapse available for Alpha testing:

                      @Danal does DuetLapse require RRF3 or a certain version or above of DWC?

                      • Supports Duet printers running V2, V3 standalone and V3 +Pi.
                      • Printer must be reachable via the network.

                      I'm interested in trying it.by I don't know.what you mean by the step that says to place the DuetLapseAPI.Ph in the python libpath? Is it enough to place all the .py files in one directory?

                      That step actually says: Copy included module https://github.com/DanalEstes/DuetWebAPI/blob/master/DuetWebAPI.py to the same directory, or to anywhere in python's libpath.

                      Thanks for the questions, I will do a bit of readme editing to make all above more clear.

                      Delta / Kossel printer fanatic

                      1 Reply Last reply Reply Quote 1
                      • tekkydaveundefined
                        tekkydave
                        last edited by

                        If it helps with putting caption overlays on your output movie files I have been playing with ffmpeg in the last few days. The command I am using is

                        ffmpeg -r 10 -i ./IMG%06d.jpg -vcodec libx264 -crf 15 -s 800x600 -pix_fmt yuv420p -y -v warning -vf drawtext="fontfile=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf: text='Text to put on screen':fontsize=40:fontcolor=yellow:box=1:boxborderw=5:boxcolor=black@0.5:x=10:y=10" movie.mp4
                        

                        This will give you a caption in the top-left with a semi-transparent black box around

                        Screenshot from 2020-04-15 14-56-24.png

                        HTH
                        Dave

                        ~ tekkydave ~
                        D-Bot: 300x300mm | Duet WiFi + Duex2 | 3 independent z motors | X,Y & Z linear rails | E3D Titan Aero + V6 | Precision Piezo z-probe
                        FreeCAD, PrusaSlicer

                        1 Reply Last reply Reply Quote 0
                        • Danalundefined
                          Danal
                          last edited by

                          What people are requesting changes as the frames flow. Things like Z height, etc. I believe those overlays need to be part of the stills.

                          Delta / Kossel printer fanatic

                          tekkydaveundefined 1 Reply Last reply Reply Quote 1
                          • tekkydaveundefined
                            tekkydave @Danal
                            last edited by tekkydave

                            @Danal said in DuetLapse available for Alpha testing:

                            What people are requesting changes as the frames flow. Things like Z height, etc. I believe those overlays need to be part of the stills.

                            That's true, if they need to reflect things changing as the print progresses.

                            I'm writing a similar program to yours. I use motioneye to generate my original images from a picam which is then displayed in the DWC Webcam view (or via a browser window).
                            Motioneye uses motion which has a http api available.

                            e.g. To take snapshots

                            http://localhost:7999/1/action/snapshot
                            

                            will cause motion to take a snapshot from Camera 1 and place it in

                            /var/lib/motioneye/Camera1
                            

                            I'm picking them up from there, creating a movie when the print is complete (ffmpeg) and uploading it to my NAS server.

                            I had thought of doing something like this for a while but you have inspired me to get it done. I admit I have "borrowed" a few ideas from your program. 🙂
                            Also I'm using Java as it's what I'm more comfortable with. I like Netbeans as an IDE as it's perfect for Java development.

                            ~ tekkydave ~
                            D-Bot: 300x300mm | Duet WiFi + Duex2 | 3 independent z motors | X,Y & Z linear rails | E3D Titan Aero + V6 | Precision Piezo z-probe
                            FreeCAD, PrusaSlicer

                            1 Reply Last reply Reply Quote 0
                            • Danalundefined
                              Danal
                              last edited by

                              @tekkydave said in DuetLapse available for Alpha testing:

                              I admit I have "borrowed" a few ideas from your program

                              The great architectural principle of "reuse". Cool!

                              Delta / Kossel printer fanatic

                              1 Reply Last reply Reply Quote 0
                              • Adrian52undefined
                                Adrian52
                                last edited by

                                Thanks very much for this. I got the program working, but the pause doesn't seem to work properly for me. I get multiple pauses on a single layer. My bed. g moves the head out of the way, so I don't have a movehead command. Using duet2 WiFi, delta, rrf3. 01rc9

                                Danalundefined 1 Reply Last reply Reply Quote 0
                                • Danalundefined
                                  Danal @Adrian52
                                  last edited by

                                  @Adrian52 said in DuetLapse available for Alpha testing:

                                  Thanks very much for this. I got the program working, but the pause doesn't seem to work properly for me. I get multiple pauses on a single layer. My bed. g moves the head out of the way, so I don't have a movehead command. Using duet2 WiFi, delta, rrf3. 01rc9

                                  Can you post your command line that you are using to invoke?

                                  Delta / Kossel printer fanatic

                                  Adrian52undefined 1 Reply Last reply Reply Quote 0
                                  • Adrian52undefined
                                    Adrian52 @Danal
                                    last edited by

                                    @Danal I used . /DuetLapse -duet 192.168.1.16 -camera pi -pause yes If I leave out the pause it works fine. Not sure why I said bed.g of course I meant pause.g, which contains a z as well as x and y moves.

                                    Danalundefined 1 Reply Last reply Reply Quote 0
                                    • Danalundefined
                                      Danal
                                      last edited by

                                      Thanks, I will take a look.

                                      Delta / Kossel printer fanatic

                                      1 Reply Last reply Reply Quote 0
                                      • THPundefined
                                        THP
                                        last edited by THP

                                        @Danal Love what you have done with DuetLapse, thanks for contributing it to the community. Overall works really well except for a couple of issues, some of which I know are on your radar such as error handling if you can't get a status update from the 3d printer (or if you are using a webcam error detecting) (as a side note, I have all hardlines between the printer and raspi 4 and computer running the camera and still randomly get errors).

                                        The first issue I noticed was that the layer detection works by looking for z height changes. This is an issue for me as I do a vertical lift on retraction with the printhead. It should also resolve the issues people had with taking pictures during mesh bed scanning.

                                        I added a function in the DuetWebAPI:

                                        def getLayer(self):
                                               URL=(f'{self._base_url}'+'/rr_status?type=3')
                                               r = self.requests.get(URL)
                                               j = self.json.loads(r.text)
                                               s = j['currentLayer']
                                               return (s)
                                        

                                        The type3 return adds the current layer height information.
                                        Then in the DuetLapse.py

                                        #        zn=printer.getCoords()['Z'] #replace with following line
                                                zn=printer.getLayer()
                                        

                                        along with updating the terminal printing in the oneInterval() function to

                                                    print('Capturing frame {0:5d} at X{1:4.2f} Y{2:4.2f} Z{3:4.2f} Layer {4:d}'.format(int(np.around(frame)),printer.getCoords()['X'],printer.getCoords()['Y'],printer.getCoords()['Z'],zn))
                                        

                                        I figured out you might want to include it in your code. I can setup a pull request if you want.
                                        Keep up the great work!

                                        P.S. I am running RRF3.0, I don't know if the layer output is included in RRF2.

                                        Also for everyone else looking to contribute or modify:
                                        I assume Danal know where the documentation for the status returns are, but for others like me who didn't know where the documentation on the firmware status returns are located, https://reprap.org/wiki/RepRap_Firmware_Status_responses

                                        Custom IDEX with Duet Ethernet & x5, IR probe, Titan Aero w/ PT100s, Heated Bed, and Chamber with Thermocouples.

                                        1 Reply Last reply Reply Quote 2
                                        • Danalundefined
                                          Danal
                                          last edited by

                                          Absolutely FANTASTIC, really, really appreciate the thoughts and code.

                                          If you wish "attribution", code it up as a pull. Otherwise, I'll just integrate it, and save you some work.

                                          Delta / Kossel printer fanatic

                                          1 Reply Last reply Reply Quote 0
                                          • THPundefined
                                            THP
                                            last edited by

                                            @Danal I don't feel I need attribution, feel free to integrate it yourself. I realized after I posted the message I don't have a good way to push selected lines of code from my raspi at this moment (a bit rusty on my cmd line git commands) and I have other minor changes (such as directory storage) included in the changes of my copy.

                                            Custom IDEX with Duet Ethernet & x5, IR probe, Titan Aero w/ PT100s, Heated Bed, and Chamber with Thermocouples.

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA