DuetLapse available for Alpha testing
-
@Danal thanks - very interesting.
-
@tekkydave said in DuetLapse available for Alpha testing:
@Danal thanks - very interesting.
Just noticed the text handling, OUTSIDE the code block, make double backslashes into single. Use the double, as shown in the code block
-
Just FYI if you need streaming as well as time lapse. I set up ustreamer as the "owner" of the camera and pointed DuetLapse at its "/snapshot" URL. That way I have both a live stream and the time lapse at the same time.
-
"camparams" error
dunno if this helps[root@localdev LAPSE]# ./DuetLapse.py -duet http://ender5.local.lan Traceback (most recent call last): File "./DuetLapse.py", line 257, in <module> init() File "./DuetLapse.py", line 74, in init camparms = args['camparms'] KeyError: 'camparms' [root@localdev LAPSE]# ./DuetLapse.py -duet ender5.local.lan Traceback (most recent call last): File "./DuetLapse.py", line 257, in <module> init() File "./DuetLapse.py", line 74, in init camparms = args['camparms'] KeyError: 'camparms' [root@localdev LAPSE]# host ender5.local.lan ender5.local.lan has address 192.168.89.246 [root@localdev LAPSE]# ./DuetLapse.py -duet 192.168.89.246 Traceback (most recent call last): File "./DuetLapse.py", line 257, in <module> init() File "./DuetLapse.py", line 74, in init camparms = args['camparms'] KeyError: 'camparms' [root@localdev LAPSE]# python --version Python 3.7.6 [root@localdev LAPSE]# [root@localdev LAPSE]# fswebcam -d /dev/video0 -F 1 kkk --- Opening /dev/video0... Trying source module v4l2... /dev/video0 opened. No input was specified, using the first. Adjusting resolution from 384x288 to 352x288. --- Capturing frame... Captured frame in 0.00 seconds. --- Processing captured image... Unable to load font 'sans': Problem doing text layout Disabling the the banner. Writing JPEG image to 'kkk'.
and here you can see how non python developer try to follow up before giving up
[root@localdev LAPSE]# ./DuetLapse.py camparms -h usage: DuetLapse.py camparms [-h] [-- ...] camparm -parms xxx where xxx is passed to fswebcam, raspistill, or wget. optional arguments: -h, --help show this help message and exit -- ..., -parms ... Extra parms to pass to fswebcam, raspistill, or wget. [root@localdev LAPSE]# ./DuetLapse.py -duet 192.168.89.246 -camera usb -parms -d /dev/video0 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} ... DuetLapse.py: error: invalid choice: '/dev/video0' (choose from 'camparms') [root@localdev LAPSE]# ./DuetLapse.py -duet 192.168.89.246 -camera usb -parms "-d /dev/video0" 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} ... DuetLapse.py: error: invalid choice: '-d /dev/video0' (choose from 'camparms') [root@localdev LAPSE]# ./DuetLapse.py -duet 192.168.89.246 -camera usb "-d /dev/video0" 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} ... DuetLapse.py: error: invalid choice: '-d /dev/video0' (choose from 'camparms') [root@localdev LAPSE]#
-
Well, drat, I obviously have gaps in my test cases.
Will be fixed and upload in 20 min or so.
-
OK, now fixed.
While I was there, I added the ability to press Ctrl+C one time, while waiting for pre-start or print running, and it will move directly to making a video. In other words, if you wish to end it before the print ends, and still want the vid, press Ctrl-C once.
-
@Danal said in DuetLapse available for Alpha testing:
Well, drat, I obviously have gaps in my test cases.
I edited the code and removed the whole camparms thing and hardcoded the call to fswebcam to test it. Having some issues now of other kind (that's a fedora vm with usb camera connected trough vm-terminal as the camera with good view of the printer is on usb on my desktop so I can monitor during testing phase ) so don't have the test video yet but so far it seems to be working. Anyhow the device and resolution are hardcoded? Why? fswebcam will use -d /dev/video0 as default anyways so I don't see reason for you to hardcode it and if user want to use other one like i420:/dev/video1 you can't pass that parametar to fswebcam as you already hardcoded video0, also resolution, what if I want 1280x960 as that's native to C270, you hardcoded 800x600 ?
Maybe let fswebcam use default values (low res, video0 ..) and show in help example how to get some decent values (higher res etc..)
-
@Danal that's a nice feature (ctrlc once)
I'll test the new code asap -
@arhi said in DuetLapse available for Alpha testing:
@Danal said in DuetLapse available for Alpha testing:
Well, drat, I obviously have gaps in my test cases.
I edited the code and removed the whole camparms thing and hardcoded the call to fswebcam to test it. Having some issues now of other kind (that's a fedora vm with usb camera connected trough vm-terminal as the camera with good view of the printer is on usb on my desktop so I can monitor during testing phase ) so don't have the test video yet but so far it seems to be working. Anyhow the device and resolution are hardcoded? Why? fswebcam will use -d /dev/video0 as default anyways so I don't see reason for you to hardcode it and if user want to use other one like i420:/dev/video1 you can't pass that parametar to fswebcam as you already hardcoded video0, also resolution, what if I want 1280x960 as that's native to C270, you hardcoded 800x600 ?
Maybe let fswebcam use default values (low res, video0 ..) and show in help example how to get some decent values (higher res etc..)
Yeah, you have very valid points. I THOUGHT I did the minimum to get a usable image... but it really looks like I should have let more things default.
I can do it two ways:
- Remove everything I can and risk the auto stuff not working for a true "newbie" for some reason or another
(Probably going to do this... low risk...)
- Have camparms replace EVERYTHING, except the file name.
-
OK, I did a little of both. Removed quite a bit from the 'defaults', AND changed it so that if you specified 'camparms -parms' the only thing that is added is the filename.
And, introduced "vidparms -parms '. Works the exact same way, except it is passed to ffmpeg.
Ready for test right now.
-
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 $
-
@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. -
I will think about a way to do this... while minimally banging on the printer between prints.
-
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
-
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.jpegEtc.
-
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
-
@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!
-
@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?
-
@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.
-
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
HTH
Dave