- Swift 89.7%
- Python 9.6%
- Metal 0.7%
Dynamically choose between fast in-memory processing and constant-memory streaming based on available system RAM (vm_statistics64). Adds MemoryBudget with configurable profiles (conservative/balanced/aggressive), streaming compression/decompression via Apple Compression OutputFilter, and index-based Data consumption to eliminate O(n) copies. Redesigns UI: ContentView with collapsible "Erweitert" section for advanced settings, new Settings window (memory profile, renderer, preview), custom German menu bar with Datei/Ansicht entries, and moves rendering/preview options out of the main view. Fixes test target module name after F2V rename. Fixes near-freeze on 8GB devices with large files. |
||
|---|---|---|
| File2VideoConverter | ||
| File2VideoConverter.xcodeproj | ||
| File2VideoConverterTests | ||
| COMPATIBILITY.md | ||
| PROJECT_CONTEXT.md | ||
| PROJECT_DOCUMENTATION.md | ||
| README.md | ||
File2VideoConverter
File2VideoConverter is a native macOS SwiftUI app that stores arbitrary files inside a visual video format and restores the original file from that video later.
The project uses the custom FTV1 transport format: file bytes are wrapped in a ZIP-compatible payload, split into validated data blocks, mapped to black-and-white visual cells, written as video frames through AVFoundation, and decoded back into the original file.
Status
This project is functional but still experimental. It is intended for local testing, format iteration, and reliability experiments with different codecs, resolutions, cell sizes, and error-correction settings.
The default path uses ProRes 422 in a MOV container. Lossy codecs such as H.264 and HEVC are available, but they require careful bitrate calibration because small video artifacts can become byte errors during decoding.
Features
- Encode arbitrary files into real video files using AVFoundation
- Decode FTV1-generated videos back into the original file
- Preserve the original filename and timestamps through a ZIP-compatible payload
- Optional zlib compression around the ZIP payload
- Optional Reed-Solomon parity per data block
- Optional sync border for more robust sampling and auto-detection
- Configurable resolution, cell size, frame rate, chunk size, codec, and bitrate preset
- Built-in bitrate calibration for lossy codecs
- Detailed status and log output for CRC32, ZIP payload handling, container blocks, video frames, and finalization
- Native macOS file and folder pickers
- Content-sized SwiftUI window that adapts to visible controls and status output
Requirements
- macOS with AVFoundation support
- Xcode
- SwiftUI and AppKit
The app is a standard Xcode project. Open File2VideoConverter.xcodeproj in Xcode and build/run the File2VideoConverter scheme.
Basic Workflow
- Open the app.
- Choose
EncodeorDecode. - Select the input file or FTV1 video.
- Select an output folder.
- For encoding, adjust settings such as compression, error correction, cell size, resolution, codec, bitrate, and chunk size.
- Start the job.
- Watch the detailed status and log output.
- Use the Finder button to reveal the generated video or restored file.
Encoding Pipeline
Encoding currently runs through these stages:
- Read file attributes and calculate a streaming CRC32.
- Build a ZIP-compatible single-file payload.
- Optionally compress the full ZIP payload with zlib.
- Plan the FTV1 container header, data blocks, Reed-Solomon parity, and frame distribution.
- Create each data block with payload length, payload bytes, block CRC32, and optional parity.
- Serialize container bytes into frame payloads.
- Add frame headers and frame CRCs.
- Render frame bytes into black-and-white cells.
- Stream frames into a video file through AVFoundation.
Decoding Pipeline
Decoding reverses the process:
- Open the video with AVFoundation.
- Read cell size from metadata or detect settings from the first frame.
- Detect sync border usage.
- Sample data cells with majority voting.
- Rebuild frame payload bytes.
- Parse and validate the FTV1 container header.
- Parse data blocks, verify CRC32, and use Reed-Solomon correction when needed.
- Optionally decompress zlib data.
- Extract the ZIP payload and write the restored file.
If a file with the same name already exists in the output folder, the decoder writes a unique decoded filename instead of overwriting it.
FTV1 Format Summary
FTV1 uses deterministic little-endian binary serialization.
The container header stores:
- magic value
FTV1 - version
0x0101 - original file size
- payload size
- block size and block count
- frame width and height
- cell size and bits per cell
- Reed-Solomon parity configuration
- compression method
- video profile
- header CRC32
Each data block stores:
- block index
- payload length
- payload bytes
- CRC32 over the payload
- optional Reed-Solomon parity bytes
Each visual frame stores:
- frame magic
0xAA55 - frame type
- frame index and total frame count
- payload bit count
- CRC32 over frame header fields and payload
- frame payload bytes
Bits are written MSB-first. One visual cell currently stores one bit: black is 0, white is 1.
Codec Guidance
For reliable local round trips, use ProRes first:
ProRes 422is the default recommendation.ProRes 422 HQandProRes 4444are also reliable but create larger files.H.264andHEVCcan work with sufficient bitrate, larger cells, and calibration.
For platform round trips such as upload/download workflows, use larger cells, enable sync border, and enable strong Reed-Solomon correction. See COMPATIBILITY.md for the current compatibility notes.
Progress Logging
The UI logs every pipeline progress message. The current implementation intentionally exposes detailed internal work, including:
CRC32ZIP-Payloadzlib-KompressionContainer schreibenVideo schreibenVideo lesenContainer dekodierenzlib-DekompressionZIP-Extraktion
Container logging is especially verbose. For each data block it can show payload slicing, block CRC32, Reed-Solomon parity or correction, serialization, frame-buffer handoff, and ZIP-payload assembly.
Project Structure
File2VideoConverter/
File2VideoConverter/
Core/ Pipeline coordination, calibration, row workers, settings detection
FileSystem/ ZIP-compatible payload creation and extraction
Format/ Binary I/O, FTV1 headers, blocks, CRC32, compression, Reed-Solomon
Media/ AVFoundation video reading and writing
Render/ Visual frame byte/cell conversion
Prototype/ Earlier Python experiments
Important reference files:
PROJECT_CONTEXT.mdcontains the current development context.PROJECT_DOCUMENTATION.mdcontains a more detailed technical overview.COMPATIBILITY.mdtracks codec, resolution, and cell-size reliability notes.File2VideoConverter/ftv1_spec_v1_1.mddocuments the current FTV1 format.
Current Limitations
- The ZIP payload currently supports a single file.
- ZIP-internal deflate is not implemented; optional zlib compression wraps the full ZIP payload instead.
- zlib progress is only reported at start and finish because Foundation's compression API does not expose intermediate progress.
- Video reliability depends on codec, bitrate, scaling, platform processing, and chosen cell size.
- Very detailed per-block logging can produce many log entries for large files.
- Broad automated round-trip coverage is still missing.
Development Notes
The core pipeline types are marked nonisolated where needed so CPU-heavy work does not accidentally run on the SwiftUI main actor. Pixel sampling and rendering use bounded multi-core row processing through ParallelRowWorker, with an optional maximum CPU mode for more aggressive throughput.
The project is still evolving. When changing format behavior, keep PROJECT_CONTEXT.md, PROJECT_DOCUMENTATION.md, and ftv1_spec_v1_1.md in sync.