Books ebooks Projects Road Testf

PiCluster At Work

The first practical experiment with the PiCluster

After setting the environment of the four nodes PiCluster – a cluster based on the Raspberry Pi 4B – I have installed the workload manager SLURM and created a set of Bash shell scripts to automate an annoying and time-consuming job: the creation of mp4 video scenes from time-lapse images, normally acquired with a camera in 4k format.

This is the first approach to using the PiCluster lying in my local network as a tool for everyday jobs. The video below shows the kind of result I have obtained assembling a long time-lapse scene to a ready-to-use mp4 video. Also, the final editing of the scenes to the finished media has been done using the open-source application OpenShot for the Raspberry pi, a non-linear video editor that includes a lot of good features we can find on the professional applications.

To reach this result, I started from 1654 4k frames acquired with an action-camera during the last hour before the sunset. Then I have defined a workflow that is the one I usually follow when manually assemble time-lapse or stop-motion sequences to video.

The scheme above shows how the workflow has been adapted to use the PiCluster as the processor of the frames

  1. This optional step convert the high resolution single frames to Full HD proportionally scaled frames. The scaling function uses the imagemagick terminal command.
  2. The source frames – no matter what is the name of the file sequence – are linked in the process folder using the Linux ln command creating a numeric set of files accordingly to the source frames in the forma 0001.jpg, 0002.jpg, 0003.jpg, etc.
  3. Depending on the number of numbered images (linked to the source frames) a shell script generates a series of SLURM batches set to process 240 frames. Considering I will produce an mp4 video at 24 fps, every batch generates a 10 seconds mp4 scene. The scenes assembly, managed by the scene batches submitted to SLURM as they are created , are made available in a destination folder.
  4. This is the fourth and the only manual step of the workflow. Using the open source OpenShot video editor (on the Raspberry Pi 4B master node of the PiCluster) all the scenes are assembled to the final mp4 video.
A 4k frame and its Full HD resized image of the time-lapse sequence.

Accordingly to the workflow, to automate the process I have created a series of shell scripts that starting from the frame set creates the numbered link files, create the 240 frames batches and submit them to SLURM. The batches are available on GitHub under LGPL 3.0 license.

Dark Mode

PiCluster (this link opens in a new window) by alicemirror (this link opens in a new window)

PiCluster project with four Raspberry Pi 4B – Master Node scripts and sources

Leave a Reply

Your email address will not be published. Required fields are marked *