Clustercode

Automatically convert your movies and TV shows from one file format to another using ffmpeg in a cluster.

Overview

Let’s look at the graphic below. It shows two nodes and how they are working together on automatically pickup new tasks and make sure that they are the only ones processing it.

process

The procedure in detail

  1. Start up the node and connect to a cluster. If the node is the first in the cluster, it will become master. Though that doesn’t affect media selection or encoding.

  2. Scan the input storage. In this directory are the media sources located in a special pattern. More on that later.

  3. One of:

    1. Select a media file. If the media is already processed, it won’t be picked again.

    2. Wait a few minutes in case no media has been found and go back to step 2.

  4. Check if any constraints would prevent this media selection.

  5. Select a profile that matches the media. A profile contains the information on how to encode the media file. Basically they are ffmpeg options.

  6. Ask the cluster if the selected media is already being converted. It it is, go back to step 3a)

  7. Encode the selected media using ffmpeg in a temporary folder.

  8. Perform a cleanup according to the selected cleanup strategy. Move the file to the output storage.

  9. Go back to step 2.

The state machine of a node should help understanding it.

statemachine

Documentation

The documentation is inspired by the Divio’s documentation structure:

Tutorials

Learning-oriented: Simple lessons to learn about Clustercode.

How-to guides

Problem-oriented: step-by-step guides to achieve a goal.

Technical reference

Information-oriented: explaining the inner ongoings of Clustercode.

Explanation

Understanding-oriented: puts Clustercode in context.