Easy tutorial to create nice timelapses of your 3D prints

Now you have a shiny new 3D printer. You start printing parts at considerable rate and haunting thingiverse for things to make. What about making a magical video of the thing that grows into reality (almost) instantly ?

This tutorial will describe this process in detail.

Explaining the process

A timelapse is a movie built from periodic pictures all looking at the same scene or slightly similar scene. The movie is not played at the same rate as the picture period (or it'll be too slow) but at usual frame rate (25fps or more). If the picture acquisition period is large, the movie will dramatically accelerate the scene that was pictured.

This usually results in a very pleasant clip to watch that's not as boring as the original (very slow) scene. However, for the illusion to work, the scene must not move or change dramatically between shots.

For a 3D printing process, this means that the pictures that'll be captured must not contains moving parts (like a hotend or the extruder), or, if they do, they must be captured when they are at the exact same position, with respect to the camera's field of view.

Requirements

So, hardware first, you'll need:

  1. A camera that's able to capture good quality pictures while being remote controllable. While a DLSR could be used here, remote control is complex. In this tutorial, we'll be using a standard USB webcam.
  2. A computer that's linked to your printer. You can use a Raspberry Pi board, or a NUC or whatever, provided it can run Octoprint software.
  3. A 3D printer with a serial port you can connect to the computer. The printer's firmware must understand G-Code commands coming from the serial port (most do)
  4. (Optional) A LED strip to light your scene
  5. (Optional) A camera mount (or tripod)

My camera choice was to use a USB webcam in UVC format (USB Video Class). You must make sure the camera is able to encode its frame in JPEG format (more on that later on). It should also support high definition format. 720p is a minimum video resolution but 1080p or more is better. Most USB webcam sold as of 2021 are UVC compatible and support MJPG format. I've listed few that I know are working in the affiliated links below.

For the software, you'll need to :

  1. Install Octoprint software on the computer. There are already multiple good tutorial explaining the installation well, so I won't repeat the process here.
  2. Install the Octolapse plugin too.
  3. Install MJPGServer software too. The installation steps are described below.
  4. (Optional) If you have a LED strip, then you'll probably need to install Marlin with Neopixel feature.

Software installation

In the usual Octoprint tutorial, they ask you to install mjpg-streamer software. I'm not fond of this software since it has some limitations that prevent doing both print monitoring and capturing timelapses. mjpg-streamer connects to your camera source and streams the JPEG frames received from the camera to a HTTP client (in your case, you are the final client, even if you watch the video via the Octoprint web interface). While it supports many sources (like, being able to encode a source to JPEG, using Raspberry Camera, etc...), it's not able to capture multiple picture resolution for a source.

So, if you want to monitor your 3D print process and capture a timelapse, you will then run your camera at full resolution most of the time and monitoring the printer will consume a huge bandwidth (in reality, it'll be slow and crappy)

Instead, I've written a software here that allows both resolution to be used at the same time, the low resolution is used for most of the monitoring process and the full resolution is used for the timelapse process. No more slutter while checking the print is going well and still capture the best possible video source material for your video needs!

In order to install it, you'll need to open a terminal on your computer or Raspberry Pi (it must run linux) and run the following commands:

$ git clone https://github.com/X-Ryl669/MJPGServer.git
$ cd MJPGServer/build/linux
$ make

Then test it's working:

$ ./mjpgsrv -p 8080 -c /dev/video0
Thank you for using MJPGServer
Detected maximum picture size as 1280 x 720
Video set up for width:640, height:480, format:MJPG - LittleEndian
Buffer 0 (len: 614400 bytes) mapped at 0x7f0c06717000
Buffer 1 (len: 614400 bytes) mapped at 0x7f0c06681000
Buffer 2 (len: 614400 bytes) mapped at 0x7f0c065eb000
Server started on: http://your.computer.ip.here:8080

You'll need to browse to http://your.computer.ip.here:8080 and if you see the stream of your webcam, it's working as expected. You can click the button and you'd get a full resolution picture from your webcam.

Finally, you'll need to instruct Octoprint to use this server for monitoring/timelapsing, so you'll need to set up the stream URL in Octoprint's setting page.

The usual stream URL are http://your.computer.ip.here:8080/mjpg for the monitoring stream and http://your.computer.ip.here:8080/full_res for the full resolution picture.

It's also displayed in your browser page, you can copy and paste from there.

Notice: The command above will start the server and it'll run until the computer is stopped or the terminal is closed. If you need to start it automatically, you'll need to write a service or configure Octoprint to run it for you.

Printing your model

When running Octolapse, you'll need to tell it when to capture picture. You want to move the extruder head out of the way when the picture is captured, or at least, move it at a fixed position between each layer.

...TO BE CONTINUED...

Article précédent Article suivant

Liens sponsorisés

Afin de m'aider à financer l'infrastructure de ce blog, je liste à la fin des billets les liens affiliés sur le matériel évoqué ci-dessus.

Articles en relation