Built-in Timelapse ends before print ends

Camera model
Standard Raspicam module

What is the problem?
The rendered timelapse video ends before the actual print ends.
This means the last frame that's then also repeated in the postroll is with the print head still in the middle of the object. Older versions (pre April 2018) did not show this behaviour; the postroll continued with "live" images as the head moved into home position.

What did you already try to solve it?
Added post-roll period of varying lengths, changed the timing of the timelapse

Logs (/var/log/webcamd.log, syslog, dmesg, ...)
(a tail -n output from the webcamd.log: )
logger: Starting Raspberry Pi camera
Running ./mjpg_streamer -o output_http.so -w ./www-octopi -n -i input_raspicam.so -ev -6 -usestills -fps 2 -x 1296 -y 730 -awb off --awbgainR 1.7 --awbgainB 1.5 -ex fixedfps -quality 50
MJPG Streamer Version.: 2.0
i: fps.............: 2
i: resolution........: 1296 x 730
i: camera parameters..............:
Sharpness 0, Contrast 0, Brightness 50
Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation -6
Exposure Mode 'fixedfps', AWB Mode 'off', Image Effect 'none'
Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128
Rotation 0, hflip No, vflip No
ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000
o: www-folder-path......: ./www-octopi/
o: HTTP TCP port........: 8080
o: HTTP Listen Address..: (null)
o: username:password....: disabled
o: commands.............: disabled
i: Starting Camera
Encoder Buffer Size 81920
100 frames captured in 29.779947 seconds (3.357964 fps)
100 frames captured in 29.548814 seconds (3.384231 fps)
100 frames captured in 29.522865 seconds (3.387205 fps)

Additional information about your setup
Octoprint 1.13.11, OctoPi Version 0.14.0, running on Raspberry Pi 3 Model B Rev 1.2

I may have found the culprit, but need to do some tests. In the config.yaml file, there is no entry "capturePostRoll: true" despite the setting for the camera being "type: timed". I've added the capturePostRoll manually and will try again once my current print finishes.

After another print, I can now confirm that the issue was a missing line in the /home/pi/.octoprint/config.yaml file:
The section of webcam:timelapse:options was missing the line "capturePostRoll: true".

I've added the line and after rebooting now the timelapses do work again as expected, i.e. the camera keeps taking pictures and adding to the timelapse for the amount specified in the dialog, instead of just repeating the last capture frame.

NOTE: This setting will disappear every time you save your timelapse configuration from the Web UI - you need to edit the config.yaml file afterwards to add the missing line back. Seems like a bug to me?

1 Like

Well, after another long-time print, it seems this setting is not quite yet the solution. Though it's documented, another timelapse I did just ended up without proper postroll again...


Currently digging through the source code to understand what's going on there...

Well, I didn't find a solution within octoprint this time. It seems there is no function for actually capturing post-roll images with version 1.3.11, so I went and threw an incredibly hacky script together that will take a snapshot every 10 seconds while the print head is above 170 °C.

I've added it to my /etc/rc.local script to launch it upon boot with

/home/pi/autolapses.sh &

and it'll happily fill up your memory card if you don't bother to process the JPEGs further, but at least now I can get timelapses that end with a completed print :slight_smile:

It will not post-process the images, just take a timestamp-named JPEG snapshot and dump it into the folder /home/pi/autolapses

That is all...


# this creates a folder of timelapse images
# by pulling a webcam snapshot
# every 10 seconds while the printhead temperature
# is above 170 degrees

mkdir -p /home/pi/autolapses

re2="\"actual\": ([0-9]+)"

while :

rawcontent=$( curl --silent 'http://localhost/api/printer/tool?apikey=ENTER_YOUR_OWN_APIKEY_HERE' )
while read -r oneLine; do
	if [[ $oneLine =~ $re3 ]]; then
	if [[ $oneLine =~ $re2 ]]; then
		if [[ $precond -eq "1" ]]; then
			# echo "Tool:"${BASH_REMATCH[1]}
			if [[ ${BASH_REMATCH[1]} -gt 170 ]]; then
				thefname=$( date "+%Y-%m-%d_%H%M%S.jpg" )
done <<< "$rawcontent" 

if [[ "$thefname" != "0" ]]; then
	curl --silent "http://localhost/webcam/?action=snapshot" -o "autolapses/$thefname"
	# echo "Captured $thefname"

sleep 10