Armada-Cluster
A lightweight, decentralized video transcoding cluster built to offload multi-threaded video encoding across Android devices running Termux (and regular Linux machines). It uses Celery, Redis, FFmpeg, and rclone (right now on SMB, can be modified) to chunk up large video files, distribute the workload to available nodes, and assemble the final product back into your media server directory (like Jellyfin).
How It Works
- Watch Folder: The Orchestrator monitors your SMB share (encoding/) for new raw video files (.mp4, .mkv, .avi, .mov).
- Chunking: When a file is found, the host downloads it locally, cuts it into 5-minute keyframe-aligned segments (modifiable) using FFmpeg, and uploads those chunks to SMB (chunks_in/).
- Distributed Encoding: A Celery task is dispatched for every chunk. Worker nodes (e.g., spare smartphones or laptops) pick up tasks 1-by-1, pull the chunk, encode it with libx265, and push the result back (chunks_out/).
- Stitching & Delivery: Once all chunks finish, the Orchestrator downloads the rendered parts, concatenates them losslessly, delivers the final output to your target folder (jellyfin/), and cleans up the temporary SMB files.
Make sure your SMB share has the correct directory layout (the installer tries to create these automatically if permissions allow) Drop any raw video straight into encoding/
To change the target video codec, CRF value, or preset, open tasks.py (after install) and modify the FFmpeg parameters in encode_chunk:
enc_cmd = [ "ffmpeg", "-y", "-i", in_local, "-c:v", "libx265", "-crf", "28", "-preset", "ultrafast", "-c:a", "aac", "-b:a", "128k", out_local ] These values are test ones, should get plenty fps on a buget phone
Note: After changing tasks.py, restart your workers using ./start-worker.sh.
To get started, clone this repo on every device you want and run the automated setup script:
cd armada-cluster
chmod +x installer.sh
./installer.sh
During installation, select your deployment setup:
- Option 1 (Host Node): Orchestrator + Celery Worker (use this on a machine that isn't running Redis).
- Option 2 (Worker Node): Celery Worker only (ideal for secondary phones/nodes).
- Option 3 (Full Primary Node): Auto-configures & launches Redis + Orchestrator + Celery Worker (best for your primary node).
The installer will prompt you for your SMB Host IP, Credentials, Share Name (e.g. sambashare), and Redis Server IP. Once installed, start your cluster using the generated scripts.