DuetLapse3
-
@t3p3tony said in DuetLapse3:
@stuartofmt would you be able to look into submitting DuetLapse to the plugin repository as well?
https://plugins.duet3d.com/I will. I have not looked at the plugin requirements. DuetLapse is written in Python, so not sure if that is an impediment.
-
@stuartofmt a DSF plugin can be written in python so that should be fine
-
@t3p3tony
Ok! So the UI presented by the plugin would be the same as the current browser ui (more-or-less)? In other words the intent of the plugin would be eliminate the use of a browser UI ?
I'm trying to tease out the desired functionality. Might a simple iframe be just as effective ? Just probing here ... -
@stuartofmt Thanks for the questions, its forced me to articulate my ideas better!
I visualised it as the "front end" UI elements are displayed as a plugin within DWC, similar to how other plugins are displayed. This would allow the setup of the time-lapse parameters in a GUI. As a bonus it would also display either a static image (last capture?) or a video feed of the camera (that could be something for a future version though)
The back end elements would run as a DSF "plugin" to manage the captures. It could gather any information it needs from the object model/intercept gcode using the DSF API. It could use the DSF API to manage the printer during the capture (either directly by sending the gcode movement and dwell commands, or by calling the a macro).
What do you think about the idea?
-
@t3p3tony
I'm wondering whether the main intent might be to use the plugin framework as a convenient means of installation?Given that DWC is browser based and the DuetLapse UI is also browser based (albeit ugly) - is there added utility having a UI within a UI compared to just having DuetLapse in a separate browser tab?. I'm not asking this to be difficult - just to better understand the ask.
For example - in DWC --> Settings --> General --> Webcam if you put in the URL for DuetLapse. You will get the Duetlapse UI by clicking the Webcam link in DWC. Is this the general sort of behavior you envisage?
Regarding the use of DSF API -- I do not know what the added benefit would be (remember - I've not looked yet). DuetLapse already interrogates the object model and sends gcode (using http). Maintaining and testing two different interfaces would need to be offset by some material advantage.
I had not thought about Duetlapse displaying the last captured image. I usually use videostream to broker images and have a link to that in my DWC. There is certainly utility in incorporating an image display function into DuetLapse - it should be straightforward enough.
-
@stuartofmt Yes they main point from the front end is it brings it into the structure of plugins which ease installation (and potentially discovery by users, once the plugin repository is more used). In addition alerting users to updates through the plugin system would be available once that feature is implemented.
The back end side of things could stay with the http API. In some ways that's more flexible as you could then run it on a Pi, without having a duet 3 in the mix. The biggest advantage of using what you have is of course that it already exists. In the long run using a DSF "plugin" for the backend instead will hopefully also ease installation and updating. It will potentially also allow for the plugin directly managing the gcode stream with nothing inserted form the slicer (using gcode interception to spot layer changes for example, carrying out some user defined functions, and then allowing the print to continue).
All that said, the most immediate benefit appears to be with a DWC plugin for the UI to ease installation and discovery.
-
@t3p3tony said in DuetLapse3:
@stuartofmt Yes they main point from the front end is it brings it into the structure of plugins ......
Can you point me to a "step by step" document / example? I've searched and searched but all I seem to find is descriptions of folder structures within a zip file, or git references that are just source code. I get that bit (more or less).
What's missing for me is a clear explanation of what goes in which folder, how those components need to be structured (internally) , and the structure (and switch meaning) for the main config file. Especially: what is the mechanism for linking to the http interface.
I've made some interim changes to my code to support the idea of its own configuration file (previously all cmd line). I need to understand what other changes may be needed.
Thx in advance.
-
@stuartofmt You can find current documentation about plugins here:
- for DSF: https://github.com/Duet3D/DuetSoftwareFramework/wiki/Third-Party-Plugins
- for DWC: https://github.com/Duet3D/DuetWebControl/wiki/Third-Party-Plugins
There is an automated build script for DWC plugins as well, it should be described in the second link, too.
DWC is being heavily changed at the moment but as a general starting point I suggest you read through these two articles and have a look at either the endstops plugin or the motion webcam server plugins. In both repos you can find a short README section explaining how they can be built.
-
Hi
This is a great solution for timelapses. Thanks!
I was wondering how I can change the webcam capture resolution. I read through the documentation but some of it was a bit over my head. My camera is capable of 1440p but duetlapse3 records at 720p. I think 1080p would be a good resolution for my videos. I use this command to start duetlapse3:sudo python3 /home/pi/ftp/files/DuetLapse/DuetLapse3.py -duet 192.168.1.8 -deletepics -seconds 20 -fps 30 -detect none -restart -camera1 web -weburl1 http://192.168.1.30/picture/2/current/ -extratime 3 -basedir /home/pi/ftp/files/DuetLapse -standby
Thanks!
PS I think a great addition would be an option to set how long the video will be and automatically adjust settings so it always comes out that length. This way you don't get timelapses of short prints that are only a few seconds long, and really long prints won't be too long and slow. Octolapse has this feature.
-
@osterac said in DuetLapse3:
Hi
This is a great solution for timelapses. Thanks!
I was wondering how I can change the webcam capture resolution.PS I think a great addition would be an option to set how long the video will be and automatically adjust settings so it always comes out that length. .......
Octolapse has this feature.DuetLapse uses ffmpeg to "stitch" together the individual frames. The primary resolution is set by the software controlling the camera. In your case, this is whatever is serving up images at
http://192.168.1.30/picture/2/current/
. That is where you will have the control over resolution.I do have a companion program
videostream
which allows the resolution to be changed for most usb cameras (and Pi cameras).https://forum.duet3d.com/topic/23759/videostream/12
On the question of video length. In a naΓ―ve way - x seconds of fixed length video would be easy to achieve. Number of images / fixed length = fps. Whether the results would be pleasing to the eye might be a value judgement.
I'm guessing this is what Octolapse does? -
@stuartofmt
I dug up some old octolapse videos and they were all at different framerates so yes, it does work that way. I looked at my webcam (motioneye) settings and it was set to 1440p. I set it to 1080p and the video was still 720p. It also had problems, it started in the middle of the print and skipped forward and backward a couple of times. It was also at 10 FPS when I requested 30 FPS. Here's the media info:Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L3.1 Format settings : CABAC / 4 Ref Frames Format settings, CABAC : Yes Format settings, Reference frames : 4 frames Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 25 s 300 ms Bit rate : 1 975 kb/s Width : 1 280 pixels Height : 720 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 10.000 FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.214 Stream size : 5.96 MiB (100%) Writing library : x264 core 155 r2917 0a84d98 Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=10 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00 Color range : Full Codec configuration box : avcC
I'll give videostream a try, do I install it on the webcam server or the pi running Duetlapse 3? I don't think I could install it on motioneye, because it's buildroot. You can install motioneye on top of a full linux distro though.
Here's a link to the faulty timelapse:
https://1drv.ms/v/s!ArZNmx9oeG5CzQKqBpTQqJG-LFmP?e=7BoTKSThanks
-
@osterac said in DuetLapse3:
@stuartofmt
I dug up some old octolapse videos and they were all at different framerates so yes, it does work that way. I looked at my webcam (motioneye) settings and it was set to 1440p. I set it to 1080p and the video was still 720p. It also had problems, it started in the middle of the print and skipped forward and backward a couple of times. It was also at 10 FPS when I requested 30 FPS. Here's the media info:Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L3.1 Format settings : CABAC / 4 Ref Frames Format settings, CABAC : Yes Format settings, Reference frames : 4 frames Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 25 s 300 ms Bit rate : 1 975 kb/s Width : 1 280 pixels Height : 720 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 10.000 FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.214 Stream size : 5.96 MiB (100%) Writing library : x264 core 155 r2917 0a84d98 Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=6 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=10 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00 Color range : Full Codec configuration box : avcC
I'll give videostream a try, do I install it on the webcam server or the pi running Duetlapse 3? I don't think I could install it on motioneye, because it's buildroot. You can install motioneye on top of a full linux distro though.
Here's a link to the faulty timelapse:
https://1drv.ms/v/s!ArZNmx9oeG5CzQKqBpTQqJG-LFmP?e=7BoTKSThanks
-
@stuartofmt
Did you mean to make a post with only a quote of me in it? -
Hmm - let me ponder the resolution side of things.
The frame-rate ought to follow the settings. I'm wondering if there is a problem with ffmpeg (would not be the first time). What version are you running
ffmpeg -version
will tellI've bever seen a video jump around like that. The
-camera1 web
setting uses wget to retrieve the images. Afterwards ffmpeg creates the video by taking the frames in sequence. I'm wondering if there is some sort of strange timing issue?As an experiment we can get the images using ffmpeg. This is my usual way, mainly because it exercises more of the code. What happens if you use this set of options?:
-weburl1 http://192.168.1.30/picture/2/current/ -camera1 other -camparam1="'ffmpeg ' + ffmpegquiet + ' -y -i ' +weburl+ ' -vframes 1 ' +fn+debug"
-
@osterac said in DuetLapse3:
@stuartofmt
Did you mean to make a post with only a quote of me in it?Yes See above
-
@stuartofmt
ffmpeg-version didn't work, so I typed sudo apt install ffmpeg and it said it was already installed with this version:
7:4.1.9-0+deb10u1+rpt1)
I tried your settings (I took the liberty of adding the duet url) and the print stopped early both times I tried. There weren't enough frames captured to make a timelapse of at least 5 seconds. The printer told me that insufficient axes were homed.pi@octopi:~ $ sudo python3 /home/pi/ftp/files/DuetLapse/DuetLapse3.py -weburl1 h ttp://192.168.1.30/picture/2/current/ -camera1 other -camparam1="'ffmpeg ' + ffm pegquiet + ' -y -i ' +weburl+ ' -vframes 1 ' +fn+debug" -duet 192.168.1.8 [sudo] password for pi: 192.168.1.8 MainThread - ################### Options at start of this print job ##################### 192.168.1.8 MainThread - # Environment 192.168.1.8 MainThread - duet 192.168.1.8 192.168.1.8 MainThread - basedir /home/pi/ftp/files/DuetLapse 192.168.1.8 MainThread - poll 12 192.168.1.8 MainThread - instances single 192.168.1.8 MainThread - logtype both 192.168.1.8 MainThread - nolog False 192.168.1.8 MainThread - verbose False 192.168.1.8 MainThread - host 0.0.0.0 192.168.1.8 MainThread - port 0 192.168.1.8 MainThread - keeplogs False 192.168.1.8 MainThread - novideo False 192.168.1.8 MainThread - deletepics False 192.168.1.8 MainThread - maxffmpeg 2 192.168.1.8 MainThread - keepfiles False 192.168.1.8 MainThread - # Execution 192.168.1.8 MainThread - dontwait False 192.168.1.8 MainThread - seconds 0 192.168.1.8 MainThread - detect layer 192.168.1.8 MainThread - pause no 192.168.1.8 MainThread - movehead [0.0, 0.0] 192.168.1.8 MainThread - rest 1 192.168.1.8 MainThread - standby False 192.168.1.8 MainThread - restart False 192.168.1.8 MainThread - # Camera 192.168.1.8 MainThread - camera1 other 192.168.1.8 MainThread - camera2 192.168.1.8 MainThread - weburl1 http://192.168.1.30/picture/2/curr ent/ 192.168.1.8 MainThread - weburl2 192.168.1.8 MainThread - # Video 192.168.1.8 MainThread - extratime 0 192.168.1.8 MainThread - fps 10 192.168.1.8 MainThread - minvideo 5 192.168.1.8 MainThread - # Overrides 192.168.1.8 MainThread - camparam1 'ffmpeg ' + ffmpegquiet + ' -y -i ' +weburl+ ' -vframes 1 ' +fn+debug 192.168.1.8 MainThread - camparam2 192.168.1.8 MainThread - vidparam1 192.168.1.8 MainThread - vidparam2 192.168.1.8 MainThread - # UI 192.168.1.8 MainThread - hidebuttons False 192.168.1.8 MainThread - # Special Functions 192.168.1.8 MainThread - execkey 192.168.1.8 MainThread - ------------------------------------------------------- ---------------- 192.168.1.8 MainThread - ####################################################### ### 192.168.1.8 MainThread - Will start capturing images on first layer change 192.168.1.8 MainThread - ####################################################### ### 192.168.1.8 MainThread - ####################################################### ### 192.168.1.8 MainThread - Video will be created when printing ends 192.168.1.8 MainThread - or if requested from the browser interface or M117 Duet Lapse3. message 192.168.1.8 MainThread - ####################################################### ### 192.168.1.8 MainThread - ####################################################### ### 192.168.1.8 MainThread - If running from a console using the command line 192.168.1.8 MainThread - Press Ctrl+C one time to stop the program and create a video. 192.168.1.8 MainThread - ####################################################### ### 192.168.1.8 MainThread - ####################################################### ######## 192.168.1.8 MainThread - Connected to printer at 192.168.1.8 192.168.1.8 MainThread - Using Duet version 3.4.1 192.168.1.8 MainThread - Using API interface rr_model 192.168.1.8 MainThread - ####################################################### ######## 192.168.1.8 gcodeLoop - ########################### 192.168.1.8 MainThread - Initiating with action set to start 192.168.1.8 gcodeLoop - Starting gcode Listener 192.168.1.8 MainThread - ++++++ start state requested ++++++ 192.168.1.8 gcodeLoop - ########################### 192.168.1.8 captureLoop - ****** Duet status changed to: Not yet determined **** * 192.168.1.8 MainThread - ++++++ Entering start state ++++++ 192.168.1.8 captureLoop - ****** Print State changed to: Waiting ***** 192.168.1.8 captureLoop - ****** Duet status changed to: idle ***** 192.168.1.8 captureLoop - ****** Print State changed to: Capturing ***** 192.168.1.8 captureLoop - ****** Duet status changed to: processing ***** 192.168.1.8 captureLoop - ****** Print State changed to: Capturing ***** 192.168.1.8 gcodeLoop - M117 Command: DuetLapse3.start 192.168.1.8 gcodeLoop - Already in start state 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 1 at layer 1 after la yer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 2 at layer 2 after la yer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 3 at layer 3 after la yer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 4 at layer 4 after la yer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 5 at layer 5 after la yer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 6 at layer 7 after la yer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 7 at layer 9 after la yer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 8 at layer 11 after l ayer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 9 at layer 13 after l ayer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 10 at layer 15 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 11 at layer 17 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 12 at layer 20 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 13 at layer 22 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 14 at layer 24 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 15 at layer 26 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 16 at layer 29 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 17 at layer 32 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 18 at layer 34 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 19 at layer 37 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 20 at layer 40 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 21 at layer 42 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 22 at layer 45 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 23 at layer 48 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 24 at layer 50 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 25 at layer 52 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 26 at layer 55 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 27 at layer 57 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 28 at layer 59 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 29 at layer 61 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 30 at layer 63 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 31 at layer 66 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 32 at layer 68 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 33 at layer 70 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 34 at layer 72 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 35 at layer 73 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 36 at layer 74 after layer change 192.168.1.8 captureLoop - Layer - Camera1: capturing frame 37 at layer 75 after layer change 192.168.1.8 captureLoop - M117 Command: DuetLapse3.completed 192.168.1.8 captureLoop - nextAction is available 192.168.1.8 nextAction - ++++++ completed state requested ++++++ 192.168.1.8 terminate - Terminating 192.168.1.8 nextAction - ++++++ Entering terminate state ++++++ 192.168.1.8 makeVideo - Command Success : ffmpeg -loglevel quiet -y -i http://1 92.168.1.30/picture/2/current/ -vframes 1 /home/pi/ftp/files/DuetLapse/octopi/19 2-168-1-8/19613_CE4_Cylindar_MORE_twisted2/Camera1_00000038.jpeg > /dev/null 2>& 1 192.168.1.8 makeVideo - Create Video from /home/pi/ftp/files/DuetLapse/octopi/19 2-168-1-8/19613_CE4_Cylindar_MORE_twisted2 192.168.1.8 makeVideo - Error: Camera1: Cannot create video of less than 5 secon ds. 192.168.1.8 terminate - ********* Waiting for captureLoop to complete ********* 192.168.1.8 terminate - ********* Waiting for captureLoop to complete ********* 192.168.1.8 terminate - ********* Waiting for captureLoop to complete ********* 192.168.1.8 terminate - ********* Waiting for captureLoop to complete ********* 192.168.1.8 terminate - Exited captureLoop 192.168.1.8 terminate - nextAction is available 192.168.1.8 terminate - Wait for video to complete 192.168.1.8 terminate - makeVideo is not running 192.168.1.8 terminate - Cleaning up files for phase: terminate 192.168.1.8 terminate - gcodeLoop is not running 192.168.1.8 terminate - Could not terminate http listener 192.168.1.8 terminate - name 'listener' is not defined 192.168.1.8 terminate - Program Terminated Killed
-
@stuartofmt
The stopping early thing was actually a problem with my end gcode. -
I'm using version 4.x of ffmpeg, only because I had to compile it some time ago for the Pi. With V7 you should be OK.
You should take a look at the captured images to see what resolution they are (with the alternate capture options I provided).
I'll wait until you generate a video and we can take a look to see if anything changed.
As an aside (and I will check), to the best of my knowledge the video creation command does not alter the resolution at all. I did check some of my captures (set to 800x600 in videostream) and the video resolution matches.
-
@stuartofmt
I managed to capture a time lapse with your settings on a longer print.
https://1drv.ms/v/s!ArZNmx9oeG5CzQMVW0IGIgVbwagj?e=QrnVhR
Don't know why my printer is making little poops, but whatever. That's a different issue. -
@stuartofmt
The captured images are 720p