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

    DuetLapse available for Alpha testing

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

                                        Sure! Let me know of any other ideas.

                                        Delta / Kossel printer fanatic

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

                                          @Adrian52 said in DuetLapse available for Alpha testing:

                                          @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.

                                          Actually.... that form of pause is not yet coded, not working. Let me make a minor change so that the script itself will issue a message to that effect.

                                          And, "coming soon", in terms of when it will work.

                                          Sorry for any confusion.

                                          Delta / Kossel printer fanatic

                                          1 Reply Last reply Reply Quote 0
                                          • Damienundefined
                                            Damien
                                            last edited by

                                            Is there a step by step guide for setting this up to work from a PC, rather than Pi?

                                            I'm a little confused as to where to put the IP addresses for the printer and Webcam in the Duetlapse.py file, etc.

                                            I have a Duet 2 Maestro, BTW.

                                            I'm using an old iPhone as an IPCam. I can see the vid on the DWC.

                                            I'm a total noob when it comes to this kind of thing.

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