DuetLapse3
-
@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 -
@osterac said in DuetLapse3:
@stuartofmt
Don't know why my printer is making little poops, but whatever. That's a different issue.Its hard to say - but it looks like excess filament is adhering to the nozzle then dropping off. You might have the nozzle a tad too hot (the initial bridging is drooping quite a bit over that short distance).
In any case - there is a very complete set of calibration steps here:
https://www.youtube.com/watch?v=kgCjDy_IgXg -
@osterac said in DuetLapse3:
@stuartofmt
The captured images are 720pOk - so there you have it. Motioneye is serving up the images at 720p (1280 x 720).
I did a print last night and set the resolution (in videostream) to 1920x1080. It worked as expected, creating the same resolution in the individual images and the resulting video.
I realize that I did not answer one of your earlier questions:
videostream
is installed on the computer to which the camera is attached i.e. USB or direct.Are you using an IP camera? If so - you will likely need to wrestle with motioneye settings to get the video stream to the resolution you want. If the camera can be used (without motioneye in the middle) as a USB camera then
videostream
will likely work.Video cameras are inconsistent from one setup to another.
This may help (in the case of a USB camera):
https://github.com/stuartofmt/Pi-Notes/blob/master/Resolution Testing.md -
@stuartofmt I think I will load pi os on my webcam server and install motioneye on top of that. That way I can use videostream, and it will be a newer version of motioneye.
-
@osterac said in DuetLapse3:
@stuartofmt I think I will load pi os on my webcam server and install motioneye on top of that. That way I can use videostream, and it will be a newer version of motioneye.
What type of camera do you have? Is it USB? Or is motioneye embedded in the camera itself and provides http access ?
The reason I ask is that you likely don't want motioneye and videostream both. One or the other. -
@stuartofmt it's a pi 4 with 2 USB webcams. I'll hold off with videostream then.
-
@osterac said in DuetLapse3:
@stuartofmt it's a pi 4 with 2 USB webcams. I'll hold off with videostream then.
Once you get the resolution set correctly (with motioneye) you should be fine.
I'm working on DuetLapse as a plugin (The DuetLapse code will be common.) . I'll add in the fixed duration option as part of that effort. Fitting it in with other things at the moment - so could be a few weeks .
-
@stuartofmt A few weeks isn't long at all! I checked the stream from motioneye by streaming it to VLC and taking a snapshot. It is indeed streaming at 720p regardless of what resolution I set. It's a cheap webcam, so that probably has something to do with it. If I plug it into my PC it will run at 2k, albiet not very well. I may just have to get a better webcam. I really appreciate all your help. Looking forward to that plugin too.
I have a Logitech c615 streaming a different view of the printer, so I'll probably check to see if the resolution is correct on that one. I would use it for timelapses, but the auto focus is horrible and my other cam has manual focus, which I prefer. Although the auto focus is adjustable via ffmpeg parameters, I haven't been able to get that to work with motioneye.
It's been nice chatting with you. I'll let you know if anything else comes up.
Thanks so much! -
@T3P3Tony said in DuetLapse3:
@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).
<snip>
All that said, the most immediate benefit appears to be with a DWC plugin for the UI to ease installation and discovery.I looked closely at the practicality of offering a plugin version of DuetLapse3. I received a lot of help from others and did make some progress.
I've decided to abandon this effort for several reasons:
a) It would would only work for SBC.
b) The dependencies in DuetLapse3 inevitably require interactions with the operating system that would not be avoided with a plugin.
c) I do not have a SBC platform and could not properly test.Having said that - I have made some improvements to DuetLapse3 which I will release soon. These including the ability to use a configuration file to set runtime options.
-
@stuartofmt firstly thanks for your efforts to this point!
I agree that an SBC would be required (as it is with DuetLapse at all right now). In addition interaction with the OS, where required, is supported by DSF if the user chooses to take that risk with a plugin (arguably no more risk than installing DuetLapse & dependencies as a third party application). We probably need to do better with how we deal with dependencies such as ffmpeg if a plugin needs them and maybe @chrishamm can provide some thoughts about a good way forward. As far as "c" is concerned we value the work that you are doing so would be happy to support you with the Duet and RaspberryPi elements of such a system in the future if the situation changes.
-
@T3P3Tony said in DuetLapse3:
@stuartofmt firstly thanks for your efforts to this point!
I agree that an SBC would be required (as it is with DuetLapse at all right now). In addition interaction with the OS, where required, is supported by DSF if the user chooses to take that risk with a plugin (arguably no more risk than installing DuetLapse & dependencies as a third party application). We probably need to do better with how we deal with dependencies such as ffmpeg if a plugin needs them and maybe @chrishamm can provide some thoughts about a good way forward. As far as "c" is concerned we value the work that you are doing so would be happy to support you with the Duet and RaspberryPi elements of such a system in the future if the situation changes.
Yes - Its a glass half full / empty situation from my perspective. Some of the dependency management can likely be done by the plugin, although success isn't always guaranteed. In the case of "failure" the fallback is no worse than doing it manually at the OS level. I'll PM you about the possibility of upgrading my controller to one that supports SBC.
-
@T3P3Tony @stuartofmt The DSF plugin manifest already supports external package dependencies (like
ffmpeg
in this case). This is the purpose of the optionalsbcPackageDependencies
array in the plugin manifest (plugin.json
). Python/pip dependencies can be specified using the optionalsbcPythonDependencies
array. -
@chrishamm does specifying the dependencies cause them to be installed, or for the plugin installation to fail if they are not present?
-
@T3P3Tony The DSF plugin service running as root installs them automatically. If the install process returns a non-zero return code, the plugin installation is aborted.
-
This is good news! To be clear:
sbcPythonDependencies
attempts apython -m pip install xyz
?Also what's the difference between
dfs-python
and "regular" python? What python version is it based on ? -
-
I have a Raspberry Pi 4 and MPEG Streamer installed. Does anyone have clear instructions on how to install Duet laps 3? I can't get it to run
or does anyone know Duet Motion https://www.makeit-3d.de/index.php/de/instrumente/duet-motion-zeitraffer-generator.html