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.
The procedure in detail
-
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.
-
Scan the input storage. In this directory are the media sources located in a special pattern. More on that later.
-
One of:
-
Select a media file. If the media is already processed, it won’t be picked again.
-
Wait a few minutes in case no media has been found and go back to step 2.
-
-
Check if any constraints would prevent this media selection.
-
Select a profile that matches the media. A profile contains the information on how to encode the media file. Basically they are ffmpeg options.
-
Ask the cluster if the selected media is already being converted. It it is, go back to step 3a)
-
Encode the selected media using ffmpeg in a temporary folder.
-
Perform a cleanup according to the selected cleanup strategy. Move the file to the output storage.
-
Go back to step 2.
The state machine of a node should help understanding it.
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.