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

    DuetLapse3

    Scheduled Pinned Locked Moved
    Third-party software
    20
    296
    30.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.
    • GoremanXundefined
      GoremanX
      last edited by

      Feature suggestion: add an option to create a symbolic link that always points to the second-most-recent photo for a currently-running timelapse. For example, the current directory for captured images on one of my printers is: /mnt/remote/KosselXT/duet/21439_CFFFP_Riser_191x25_links
      An option to have a symbolic link at /mnt/remote/KosselXT/current.jpg that always points to the second-most-recent image would allow us to add it to the DWC interface as a webcam image by serving that file over http. The symbolic link would have to be updated every frame. The reason I'm specifically referring to the second-most-recent image is that sometimes the current image isn't complete yet when DWC tries to display it. Pointing the link to the second-most-recent image would always display a complete image, at the expense of being a few seconds behind.

      stuartofmtundefined 1 Reply Last reply Reply Quote 0
      • stuartofmtundefined
        stuartofmt @JohnOCFII
        last edited by

        @johnocfii said in DuetLapse3:

        I’ve found that it’s important / helpful to prove the command independently of systemctl first. What do you get from the log file when you use the same command with -verbose ?

        1 Reply Last reply Reply Quote 0
        • stuartofmtundefined
          stuartofmt @GoremanX
          last edited by

          @goremanx
          Not sure what this has to do with DWC and Duet Lapse3. Why not just point DWC to the same camera source as DuetLapse3?

          GoremanXundefined 1 Reply Last reply Reply Quote 0
          • GoremanXundefined
            GoremanX @stuartofmt
            last edited by

            @stuartofmt Because DWC's "webcam" feature only supports a url pointing to a specific image over http. I used to generate that image with my pi camera, but now the camera is monopolized by the timelapse. Since the image I want to see has already been taken for the timelapse, it seems like a good way to kill two birds with one stone. That image could also be used to show the most recent frame on the timelapse status page.

            stuartofmtundefined 1 Reply Last reply Reply Quote 0
            • stuartofmtundefined
              stuartofmt @GoremanX
              last edited by stuartofmt

              @goremanx said in DuetLapse3:

              but now the camera is monopolized by the timelapse.

              What software are you using to serve up the images from the pi camera ? If its raspistill - yes, it (and some others) only accept a single connection?

              Here is what I use - simple and effective: I often have multiple DuetLapse3's, a separate browser and DWC (be sure to enable webcam image in an iframe) - all connected to the one instance.

              stream.py

              line 75 can be edited for the port number, line 70 for rotation.

              1 Reply Last reply Reply Quote 0
              • stuartofmtundefined
                stuartofmt @JohnOCFII
                last edited by

                @johnocfii said in DuetLapse3:

                    referer = self.headers['Host']
                    split_referer = referer.split(":", 1)
                

                What this is saying is that the request (from the browser) did not contain a well formed header url (what you would normally see in the first part of the address bar) E.g. localhost:port ..... or ipaddress:port ......
                Just why I cannot say.

                Does it generally work ? Was this a transient ? Is it repeatable in any way ?

                I'm about to release a small upgrade and might be able to include some checks / mitigation but don't really know what to do if it fails. Any verbose logs or other info would be especially helpful.

                JohnOCFIIundefined 1 Reply Last reply Reply Quote 0
                • JohnOCFIIundefined
                  JohnOCFII @stuartofmt
                  last edited by

                  @stuartofmt Greetings!

                  I added -verbose and ran from the command line with no issues. So -- I added verbose into the systemctl script, and it ALSO ran without issue. Then I removed the -verbose tag, and things continued to work.

                  I blame it on the Moderna vaccine I received the other day. πŸ˜‰

                  I have no idea what my issue was... Sorry if I caused you to rack your brain.

                  John

                  pi@octocore:/opt/DuetLapse $ 
                  pi@octocore:/opt/DuetLapse $ python3 /opt/DuetLapse/startDuetLapse3.py -port 8082 -args="-duet railcore.localdomain -camera1 web -weburl1 http://octocore.localdomain:8081/snapshot -detect layer -extratime 4 -verbose"
                  ***** Started http listener *****
                  Cleaning up phase:  startup
                  railcore.localdomain 
                  railcore.localdomain ################### Options selected for this run #####################
                  railcore.localdomain #Environment Settings:
                  railcore.localdomain # printer         = railcore.localdomain                              
                  railcore.localdomain # basedir         = /opt/DuetLapse                                    
                  railcore.localdomain # poll            = 5                                                 
                  railcore.localdomain # logtype         = both                                              
                  railcore.localdomain # verbose         = True                                              
                  railcore.localdomain # os              = Linux                                             
                  railcore.localdomain # host            = 0.0.0.0                                           
                  railcore.localdomain # port            = 0                                                 
                  railcore.localdomain # pid             = 5350                                              
                  railcore.localdomain # keeplogs        = False                                             
                  railcore.localdomain # novideo         = False                                             
                  railcore.localdomain # deletepics      = False                                             
                  railcore.localdomain # maxffmpeg       = 2                                                 
                  railcore.localdomain #Execution Setings:
                  railcore.localdomain # dontwait        = False                                             
                  railcore.localdomain # seconds         = 0                                                 
                  railcore.localdomain # detect          = layer                                             
                  railcore.localdomain # pause           = no                                                
                  railcore.localdomain # standby         = False                                             
                  railcore.localdomain #Camera1 Settings:
                  railcore.localdomain # camera1         = web                                               
                  railcore.localdomain # weburl1         = http://octocore.localdomain:8081/snapshot         
                  railcore.localdomain # Video Settings:
                  railcore.localdomain # extratime   =     4.0                                               
                  railcore.localdomain ###################################################################
                  railcore.localdomain 
                  ffmpeg version git-2020-12-24-29cef1b Copyright (c) 2000-2020 the FFmpeg developers
                    built with gcc 8 (Raspbian 8.3.0-6+rpi1)
                    configuration: --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --extra-libs='-lpthread -lm -latomic' --arch=armel --enable-gmp --enable-gpl --enable-libass --enable-libdrm --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libssh --enable-libvorbis --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-mmal --enable-nonfree --enable-omx --enable-omx-rpi --enable-version3 --target-os=linux --enable-pthreads --enable-openssl --enable-hardcoded-tables
                    libavutil      56. 62.100 / 56. 62.100
                    libavcodec     58.115.102 / 58.115.102
                    libavformat    58. 65.100 / 58. 65.100
                    libavdevice    58. 11.103 / 58. 11.103
                    libavfilter     7. 94.100 /  7. 94.100
                    libswscale      5.  8.100 /  5.  8.100
                    libswresample   3.  8.100 /  3.  8.100
                    libpostproc    55.  8.100 / 55.  8.100
                   ... tpad              V->V       Temporarily pad video frames.
                  railcore.localdomain 
                  railcore.localdomain ###############################################################
                  railcore.localdomain Connected to printer at railcore.localdomain using Duet version 3.2.2 and API access using rr_model
                  railcore.localdomain ###############################################################
                  railcore.localdomain 
                  railcore.localdomain 
                  railcore.localdomain ##########################################################
                  railcore.localdomain Will start capturing images on first layer change
                  railcore.localdomain ##########################################################
                  railcore.localdomain 
                  railcore.localdomain 
                  railcore.localdomain ##########################################################
                  railcore.localdomain Video will be created when printing ends.
                  railcore.localdomain On Linux   -  press Ctrl+C one time to stop capture and create video.
                  railcore.localdomain On Windows -  Ctrl+C will NOT create a video. You must use the http listener
                  railcore.localdomain ##########################################################
                  railcore.localdomain 
                  railcore.localdomain ++++++ Entering start state ++++++
                  railcore.localdomain ++++++ Entering start state ++++++
                  railcore.localdomain ****** Duet status changed to: idle *****
                  railcore.localdomain ****** Print State changed to: Capturing *****
                  railcore.localdomain !!!!!! Stopped by SIGINT or CTL+C - Post Processing !!!!!!
                  railcore.localdomain ++++++ Entering terminate state ++++++
                  railcore.localdomain Working directory created at: /opt/DuetLapse/octocore/railcore-localdomain/5350
                  2021-03-28 15:02:21 URL:http://octocore.localdomain:8081/snapshot [128008/128008] -> "/opt/DuetLapse/octocore/railcore-localdomain/5350/Camera1_00000001.jpeg" [1]
                  railcore.localdomain Camera1: Cannot create video with only 1 frames
                  Cleaning up phase:  terminate
                  railcore.localdomain Program Terminated
                  ^C!!!!!! Stopped by SIGINT or CTL+C  !!!!!!
                  Killed
                  pi@octocore:/opt/DuetLapse $ 
                  
                  
                  1 Reply Last reply Reply Quote 0
                  • stuartofmtundefined
                    stuartofmt
                    last edited by stuartofmt

                    Some fairly small but useful additions. Personally - I am tending to use -keepfiles in all instances and using startDuetLapse3 to manually tidy up etc. as I need to.

                    ###Version 3.4.2###
                    Changes to DuetLapse3
                    -[1] Added a new options: -keepfiles to prevent file deletion on startup and shutdown.
                    -[2] Terminate (from the UI) now offers two options: Graceful and Forces. Graceful is the same as in prior versions. Forced does a quick shutdown with no image capture.
                    -[3] Added an optional argument (-maxffmpeg) that limits the number of concurrent ffmpeg instances. Ffmpeg can fail due to lack of resources - the default is 2 instances.
                    Note that this only applies to video creation. Image capture, because it is transient, is not limited.

                    Changes to startDuetLapse3
                    [1] Can now delete empty directories (provided they are not in use). This allows a complete cleanup of the directory tree.
                    [2] Added file function to create a Video on directories containing jpeg files (provided they are not in use).
                    [3] Added an optional argument (-maxffmpeg) that limits the number of concurrent ffmpeg instances. Ffmpgeg can fail due to lack of resources - the default is 2 instances.
                    Note that this only applies to video creation.

                    1 Reply Last reply Reply Quote 1
                    • war4peaceundefined
                      war4peace
                      last edited by war4peace

                      Hi all,

                      I have installed DuetLapse3 and verified it's running well (it does).
                      But with me being a newbie at all Linux-things, I'm not sure about some basic things...

                      1. What would be the best way to have DuetLapse3 start at boot? I have added this line to rc.local but not sure if it would work:
                      /home/pi/duetlapse/duetlapse.sh start &
                      

                      If I run "duetlapse.sh start" it works.

                      1. Is it ok if I keep DuetLapse3 running at all times? Would it start capturing automatically, every time I start a print, and stop capturing when print is finished? I have DWC, uStreamer and DuetLapse3 on the same RPi (RPi 4 4 GB).

                      3 (LE). One more thing. I have noticed that DuetLapse3 terminates itself after a print is finished and a video is created. I would like to automate video capture and not worry about whether DuetLapse3 is started or not when I start a job. This means I'm fine with DuetLapse3 being active all the time and capturing all my prints. Question is, how would I go about automating that? Keep DuetLapse3 idle and waiting all the time, start capturing when print starts, save video and go back to idle, waiting for a new job to start.

                      stuartofmtundefined 1 Reply Last reply Reply Quote 0
                      • JohnOCFIIundefined
                        JohnOCFII
                        last edited by

                        Greetings -- My last couple of prints, I noticed that I wasn't getting my "extratime". The log told me that my version of ffmpeg didn't support it, even though it was the version I built locally on my Pi last December.

                        pi@octocore:/opt/DuetLapse/octocore/railcore-localdomain $ more 15379_21-05-17T16ΛΈ40ΛΈ44.log 
                        2021-05-17 16:40:45,112 - 
                        2021-05-17 16:40:45,114 - ################### Options selected for this run #####################
                        2021-05-17 16:40:45,114 - #Environment Settings:
                        2021-05-17 16:40:45,115 - # printer         = railcore.localdomain                              
                        2021-05-17 16:40:45,116 - # basedir         = /opt/DuetLapse                                    
                        2021-05-17 16:40:45,116 - # poll            = 5                                                 
                        2021-05-17 16:40:45,117 - # logtype         = both                                              
                        2021-05-17 16:40:45,118 - # verbose         = False                                             
                        2021-05-17 16:40:45,118 - # os              = Linux                                             
                        2021-05-17 16:40:45,119 - # host            = 0.0.0.0                                           
                        2021-05-17 16:40:45,119 - # port            = 0                                                 
                        2021-05-17 16:40:45,120 - # pid             = 15379                                             
                        2021-05-17 16:40:45,120 - # keeplogs        = False                                             
                        2021-05-17 16:40:45,121 - # novideo         = False                                             
                        2021-05-17 16:40:45,122 - # deletepics      = False                                             
                        2021-05-17 16:40:45,122 - # maxffmpeg       = 2                                                 
                        2021-05-17 16:40:45,123 - # keepfiles       = False                                             
                        2021-05-17 16:40:45,123 - #Execution Setings:
                        2021-05-17 16:40:45,124 - # dontwait        = False                                             
                        2021-05-17 16:40:45,125 - # seconds         = 0                                                 
                        2021-05-17 16:40:45,126 - # detect          = layer                                             
                        2021-05-17 16:40:45,127 - # pause           = no                                                
                        2021-05-17 16:40:45,128 - # standby         = False                                             
                        2021-05-17 16:40:45,128 - #Camera1 Settings:
                        2021-05-17 16:40:45,129 - # camera1         = web                                               
                        2021-05-17 16:40:45,130 - # weburl1         = http://octocore.localdomain:8081/snapshot         
                        2021-05-17 16:40:45,131 - # Video Settings:
                        2021-05-17 16:40:45,132 - # extratime   =     4.0                                               
                        2021-05-17 16:40:45,133 - ###################################################################
                        2021-05-17 16:40:45,133 - 
                        2021-05-17 16:40:45,432 - 
                        2021-05-17 16:40:45,433 - ************************************************************************************
                        2021-05-17 16:40:45,434 - Warning: This version of ffmpeg does not support -extratime
                        2021-05-17 16:40:45,434 - -extratime has been set to 0
                        2021-05-17 16:40:45,435 - ************************************************************************************
                        2021-05-17 16:40:45,758 - 
                        2021-05-17 16:40:45,759 - ###############################################################
                        2021-05-17 16:40:45,760 - Connected to printer at railcore.localdomain using Duet version 3.3RC2 and API access using rr_model
                        2021-05-17 16:40:45,761 - ###############################################################
                        2021-05-17 16:40:45,761 - 
                        2021-05-17 16:40:45,762 - 
                        2021-05-17 16:40:45,763 - ##########################################################
                        2021-05-17 16:40:45,764 - Will start capturing images on first layer change
                        2021-05-17 16:40:45,764 - ##########################################################
                        2021-05-17 16:40:45,765 - 
                        2021-05-17 16:40:45,766 - 
                        2021-05-17 16:40:45,767 - ##########################################################
                        2021-05-17 16:40:45,767 - Video will be created when printing ends.
                        2021-05-17 16:40:45,768 - On Linux   -  press Ctrl+C one time to stop capture and create video.
                        2021-05-17 16:40:45,769 - On Windows -  Ctrl+C will NOT create a video. You must use the http listener
                        2021-05-17 16:40:45,769 - ##########################################################
                        2021-05-17 16:40:45,770 - 
                        
                        

                        even though the filter showing tpad was there:

                        pi@octocore:/opt/DuetLapse $ ffmpeg -filters | grep tpad
                        ffmpeg version git-2020-12-24-29cef1b Copyright (c) 2000-2020 the FFmpeg developers
                          built with gcc 8 (Raspbian 8.3.0-6+rpi1)
                          configuration: --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib --extra-libs='-lpthread -lm -latomic' --arch=armel --enable-gmp --enable-gpl --enable-libass --enable-libdrm --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libssh --enable-libvorbis --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-mmal --enable-nonfree --enable-omx --enable-omx-rpi --enable-version3 --target-os=linux --enable-pthreads --enable-openssl --enable-hardcoded-tables
                          libavutil      56. 62.100 / 56. 62.100
                          libavcodec     58.115.102 / 58.115.102
                          libavformat    58. 65.100 / 58. 65.100
                          libavdevice    58. 11.103 / 58. 11.103
                          libavfilter     7. 94.100 /  7. 94.100
                          libswscale      5.  8.100 /  5.  8.100
                          libswresample   3.  8.100 /  3.  8.100
                          libpostproc    55.  8.100 / 55.  8.100
                         ... tpad              V->V       Temporarily pad video frames.
                        pi@octocore:/opt/DuetLapse $ 
                        
                        

                        I rebuilt ffmpeg again following the instructions in the GitHub pages, but other than seeing that I do have the new version, the log still shows that "Warning: This version of ffmpeg does not support -extratime"

                        The extra time feature was working fine a couple of months ago.

                        Any ideas, or places to check?

                        Thanks,

                        John

                        stuartofmtundefined 1 Reply Last reply Reply Quote 0
                        • stuartofmtundefined
                          stuartofmt @JohnOCFII
                          last edited by

                          @johnocfii said in DuetLapse3:

                          The extra time feature was working fine a couple of months ago.
                          Any ideas, or places to check?

                          Let me take a look later today / tomorrow. Its entirely possible that I introduced some logic error in a later version. I did do some 'tidy up' so it could easily 'no good deed goes un-punuished'

                          What version of DuetLapse3 are you on ? Sorry that you had to rebuild ffmpeg.

                          JohnOCFIIundefined 1 Reply Last reply Reply Quote 0
                          • stuartofmtundefined
                            stuartofmt @war4peace
                            last edited by

                            @war4peace said in DuetLapse3:

                            But with me being a newbie at all Linux-things, I'm not sure about some basic things...

                            Sorry - for some reason I did not get notification of your post (or I fat fingered it) and only now just saw your question.

                            I'm tied up all day - but will give you a considered answer later today (if I can ) but more likely tomorrow. The good news is that its all possible and pretty straightforward BUT there are options πŸ™‚

                            war4peaceundefined 1 Reply Last reply Reply Quote 0
                            • JohnOCFIIundefined
                              JohnOCFII @stuartofmt
                              last edited by

                              @stuartofmt said in DuetLapse3:

                              What version of DuetLapse3 are you on ? Sorry that you had to rebuild ffmpeg.

                              I'm running 3.4.2. I was on 3.4.1 before that.

                              John

                              stuartofmtundefined 1 Reply Last reply Reply Quote 0
                              • stuartofmtundefined
                                stuartofmt @JohnOCFII
                                last edited by

                                @johnocfii said in DuetLapse3:

                                I'm running 3.4.2. I was on 3.4.1 before that.

                                Do you mind trying 3.4.3. Looks like it was a silly mistake - but I do not have time to rigorously test at the moment.

                                JohnOCFIIundefined 2 Replies Last reply Reply Quote 0
                                • JohnOCFIIundefined
                                  JohnOCFII @stuartofmt
                                  last edited by

                                  @stuartofmt sure - I'll try that soon.

                                  1 Reply Last reply Reply Quote 0
                                  • JohnOCFIIundefined
                                    JohnOCFII @stuartofmt
                                    last edited by

                                    @stuartofmt Worked great! https://youtu.be/vvtMgD2nNE0

                                    1 Reply Last reply Reply Quote 0
                                    • war4peaceundefined
                                      war4peace @stuartofmt
                                      last edited by

                                      @stuartofmt
                                      No rush, I am still tuning and polishing a lot of things with my printer. Take your time πŸ™‚

                                      stuartofmtundefined 1 Reply Last reply Reply Quote 0
                                      • stuartofmtundefined
                                        stuartofmt @war4peace
                                        last edited by

                                        @war4peace

                                        Hi - I think the simplest approach (for now) is to run DuetLapse3.py using the linux systemctl capability.

                                        I updated the instructions here:
                                        https://github.com/stuartofmt/DuetLapse3/blob/main/systemctl setup.md
                                        and added a sample unit file (.service extension) here:
                                        https://github.com/stuartofmt/DuetLapse3/blob/main/DuetLapse3.service

                                        Note that you want to make sure the options you have set are perfected by running DuetLapse3 from the command console, before you replicate these in the unit file.

                                        Essentially - using this approach, DuetLapse3 will terminate normally at the end of each print job and then restart.

                                        In particular - you likely (definitely) want to have -detect layer set. Otherwise - on restart of DuetLapse3, even if there is no print job running, it may start capturing images the entire time 😞

                                        war4peaceundefined 1 Reply Last reply Reply Quote 0
                                        • war4peaceundefined
                                          war4peace @stuartofmt
                                          last edited by war4peace

                                          @stuartofmt

                                          Thank you for your answer.

                                          Here's my command line (tested to be working, located in a bash file, see below):

                                          /usr/bin/python3 $PROCESS -duet localhost -basedir /home/pi/duetlapse/output -camera1 stream -weburl1 http://localhost:8181/stream -detect layer -seconds 10  -extratime 10 -instances oneip -deletepics -port 8282 &
                                          

                                          I am trying to follow the instructions listed, but I have a couple questions.
                                          In the document it says "This needs to be the directory for BOTH startDuetLapse3.py and DuetLapse3.py" - there is no "startDuetLapse3.py" file to be found.
                                          Here's the full list of files in the DuetLapse folder:

                                          pi@duet3:~/duetlapse $ find "$(pwd)"
                                          /home/pi/duetlapse
                                          /home/pi/duetlapse/duetlapse.sh
                                          /home/pi/duetlapse/DuetLapse3.py
                                          /home/pi/duetlapse/output
                                          /home/pi/duetlapse/output/duet3
                                          /home/pi/duetlapse/output/duet3/localhost
                                          /home/pi/duetlapse/startDuetLapse3.service
                                          

                                          As for starting DUetLapse, I am using a bash file with the following contents:

                                          #! /bin/bash
                                          #Example bash script for running DuetLapse3.py
                                          
                                          PROCESS=/home/pi/duetlapse/DuetLapse3.py
                                          
                                          case "$1" in
                                             start)
                                          #Edit and uncomment for your own needs
                                          #One camera example
                                                /usr/bin/python3 $PROCESS -duet localhost -basedir /home/pi/duetlapse/output -camera1 stream -weburl1 http://localhost:8181/stream -detect layer -seconds 10  -extratime 10 -instances oneip -deletepics -port 8282 &
                                          #  Two camera example
                                          #/usr/bin/python3 $PROCESS -duet 192.168.86.235 -basedir /home/pi/Lapse -instances oneip -dontwait -seconds 3 -camera1 stream -weburl1 http://192.168.86.230:8081/stream.mjpg  -camera2 other -weburl2 http://192.168.86.230:8081/st$
                                             ;;
                                             stop)
                                                if ["$2" == '']
                                                then
                                                    PROCESS_PID=`/bin/ps -ef | grep "$PROCESS" | grep -v "grep" | awk '{print $2}'`
                                                    kill -2 $PROCESS_PID
                                                else
                                                    PROCESS_PID=`/bin/ps -ef | grep "$PROCESS" | grep "$2" | grep -v "grep" | awk '{print $2}'`
                                                    kill -2 $PROCESS_PID
                                               fi
                                             ;;
                                          esac
                                          

                                          Can I use that bash script instead of startDuetLapse3.py?

                                          I am a newbie in linux-world, sorry for the arguably stupid questions...

                                          JohnOCFIIundefined stuartofmtundefined 2 Replies Last reply Reply Quote 0
                                          • JohnOCFIIundefined
                                            JohnOCFII @war4peace
                                            last edited by

                                            @war4peace The file startDuetLapse3.py can be found along with the rest of the DuetLapse files here: https://github.com/stuartofmt/DuetLapse3

                                            It is fairly straightforward to replicate if needed.

                                            John

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