Architecture
Pipeline Overview
1. The Encoder
- Input Stream: Reads the input file in 1MB chunks.
- Reed-Solomon FEC: Splits data into
10data shards and calculates2parity shards (configurable). This allows recovering the file even if 20% of the data in a frame is lost. - Block Scaling: Each logical bit is expanded into a block of pixels (e.g., 4x4). This makes the signal robust against video compression algorithms (H.264/VP9) which blur high-frequency noise.
- FFmpeg Pipe: The raw pixel frames are piped into
ffmpegvia stdin to generate the video container (mkvormp4).
2. The Decoder
- FFmpeg Pipe: Spawns
ffmpegto read the video file and output raw RGB frames. - Bit Extraction: Scans the center of each pixel block to determine if it is a
0or1, effectively downsampling the image. - Header Parsing: The first frame(s) contain a JSON header with file metadata (Filename, Size, Hash).
- Reconstruction: Uses the Reed-Solomon engine to rebuild missing or corrupted shards.
- Output: Writes the reconstructed bytes to the output file.
Zero-Copy Design
The tool is designed to handle files larger than available RAM. It uses streaming iterators and buffers only a few frames at a time.