The rfc command line
Run Refocused without the GUI — start the engine, submit and monitor jobs, build hardware-optimized engines, and script your whole workflow.
Overview
rfcis the RefocusedEngine command-line client. It starts and stops the engine, submits and cancels jobs, monitors progress, builds hardware-optimized inference engines, and manages configuration. It talks to a running engine over the engine's local HTTP command API (default localhost:8080).
rfc [OPTIONS] # interactive mode (full-screen UI) rfc [OPTIONS] COMMAND [ARGS...] # run one command and exit
Everything the desktop app does with jobs, the CLI can do headless — the app andrfc are both clients of the same engine.
Installation
rfc ships two ways:
Inside the Refocused app
The CLI is bundled at Refocused.app/Contents/Resources/bin/rfc. To put rfc on your PATH, run once:
/Applications/Refocused.app/Contents/Resources/scripts/install_cli.sh
CLI-only bundle
A standalone bundle (RefocusedCLI-<version>-macos_arm64.tar.gz, no GUI) is available for headless machines. Extract it anywhere and run ./install_cli.sh from the extracted directory.
Both create a symlink at /usr/local/bin/rfc and, if missing, the default engine configuration at ~/Documents/RefocusedApp/configs/app_config.json.
Quick start
# license this machine (no account required) rfc redeem RF-XXXX-XXXX-XXXX # start the engine in the background rfc start # submit a job file (see "Job files" below) rfc add my_job.json # watch progress in the full-screen UI rfc # stop everything when done rfc shutdown
Run rfc with no command for the interactive full-screen UI — a command bar plus Output, History, and Help tabs. All commands work in the command bar; arrow keys recall history, Tab moves between UI elements, and exit leaves the UI while the engine keeps running.
Command reference
Engine lifecycle
| rfc start | Start RefocusedEngine in the background (with monitoring and the command API enabled) and connect. |
| rfc stop | Stop the engine. In interactive mode, rfc stays open. |
| rfc shutdown | Shut down the engine. In interactive mode, also exits rfc. |
| rfc pause | Pause job processing. |
| rfc resume | Resume job processing. |
Jobs
| rfc add <job_file> | Submit a job from a JSON job file. The engine must be running. |
| rfc cancel <job_id> | Cancel a running job. In interactive mode, cancel with no ID cancels the active job. |
Engine optimization
Optimization builds inference engines tuned for your local hardware. Builds run asynchronously on the engine and are polled with status:
rfc optimize <type> [key=value ...] # start a build rfc optimize <type> status # show the running build's status rfc optimize <type> cancel # cancel the running build
| Type | Description |
|---|---|
| cml_dynamic / trt_dynamic | Refocus super-resolution engines (CoreML on macOS / TensorRT on NVIDIA) |
| cml_regenerate | Regenerate diffusion engine (macOS) |
| cml_regenerate_q / trt_regenerate_q | Regenerate-Q streaming engine |
| cml_vfi / trt_vfi | Frame-interpolation engine |
| cml_depth_est / trt_depth_est | Depth-estimation engine |
| cml_denoise / trt_denoise | Denoise engine |
| cml_segment / trt_segment | SAM 2.1 segmentation engine |
Build parameters are passed as key=value pairs (tile sizes, variant, force_overwrite, ...). The trt_* types additionally accept opt_level=<0–5> (TensorRT builder optimization level, default 3) and compatible=true for hardware-portable engines. The engine runs one build at a time.
rfc optimize cml_segment variant=tiny rfc optimize cml_regenerate_q tile=768 kv_len=3 rfc optimize cml_dynamic tiles="270,480;540,960" rfc optimize cml_depth_est variant=relative size=small rfc optimize trt_denoise tile_h=512 tile_w=768 opt_level=1
Engine refresh
| rfc refresh engines | Rescan the engines directory on the running engine — pick up newly installed engines without a restart. |
| rfc refresh config | Reload configuration on the running engine. |
Device & licensing
| rfc deviceid | Print this machine's device ID (used for license issuance). Does not require a running engine. |
| rfc redeem <code> | Redeem a one-time license code and install the resulting device-bound license file — no user account required. Also saves an API key for model-weight downloads. Restart the engine afterwards to load the license. |
Configuration
rfc set <key> <value> writes CLI settings to the CLI config file, and anything else — including dot-notation keys — to the engine configuration file (see Engine configuration):
rfc set job_history_length 5 rfc set output.enable_history_logging true
| CLI setting | Type | Default | Description |
|---|---|---|---|
| application_config_path | path | configs/app_config.json | Engine config used by start/optimize |
| job_history_length | 0–100 | 1 | Jobs kept in the history view |
| refresh_interval_ms | 100–10000 | 1000 | UI data refresh interval |
| log_display_lines | 5–100 | 10 | Log lines shown for build output |
| default_display_mode | enum | help | output, history, or help — tab shown at startup |
| host | host/IP | localhost | Engine host (restart rfc to apply) |
| port | 1–65535 | 8080 | Engine port (restart rfc to apply) |
Job files
A job file is a JSON array of job objects. A file with one entry runs one job; multiple entries run in order, which is how batches and multi-stage pipelines are expressed. Only three fields are required — id, input_path, and output_path; everything else has sensible defaults.
[
{
"id": "beach_refocus_4x",
"input_path": "footage/beach_1080.mp4",
"output_path": "output/beach_8k.mp4",
"model_type": "refocus",
"encoder": {
"vcodec": "hevc_videotoolbox",
"pix_format": "p010le",
"container": "mp4"
}
}
]Top-level fields
| Field | Type | Default | Description |
|---|---|---|---|
| id | string | Required. Stable job identifier, used in logs, monitoring, and history. | |
| input_path | string | Required. Input video path — absolute, or relative to the engine working directory. | |
| output_path | string | Required. Output video path, or output directory when output_mode is image_sequence. | |
| model_type | enum | refocus | Model family: refocus, regenerate, regenerate_q, vfi, depth_est, or denoise. |
| engine_type | enum | auto | Inference backend override (e.g. refocus_cml, regenerate_q_trt). Usually unnecessary — model_type routes the job and the backend is inferred from your platform. |
| engine | string | Engine override: a built engine's folder name (e.g. 768x768_kv3_f16) or an absolute path. By default the engine best matching the job is selected automatically. | |
| scaling | object | Upscale factor and input/output downscales — see below. | |
| encoder | object | Video encoder settings — see below. | |
| output_mode | enum | video | video or image_sequence. |
| image_output | object | Image-sequence settings — see below. | |
| copy_audio | bool | true | Copy input audio into the output (stream copy, trimmed to the clip range). Video mode only. |
| clip_start_frame | int | First input frame to process (inclusive). | |
| clip_end_frame | int | End frame boundary — process only part of the input. | |
| tile_feather | bool | true | Linearly blend overlapping tile regions during assembly to soften tile seams. Applies to any tiling model. |
| sharpen_input / sharpen_output | object | Optional sharpening before/after enhancement: { "sharpen_factor": 0.5, "sharpen_radius": 50 }. | |
| depth_variant | enum | relative | Depth estimation: relative or metric (real-world meters). |
| depth_size | enum | small | Depth estimation encoder size: small, base, or large. |
| denoise_strength | number | 30 | Denoise sigma on a 0–255 scale. Higher removes more noise at the cost of fine texture. |
| refocus / regenerate / vfi / denoise | object | Per-model tuning blocks — see below. |
scaling
| Field | Type | Description |
|---|---|---|
| upscale_factor | int | Overall upscale factor, e.g. 2 or 4. Enhancement models run at their native 4×; other factors are reached via downscales. |
| input | object | Downscale applied before inference: downscale_factor (e.g. 0.5) or explicit downscale_width/downscale_height. Trades resolution for speed. |
| output | object | Downscale applied to the upscaled result — same fields as input. A 4× upscale with a 0.5× output downscale yields a clean 2× result. |
encoder
All fields optional; values are FFmpeg names, so any string your media libraries support is accepted. Which encoders are available depends on the platform — hardware H.264/H.265 via VideoToolbox (macOS) or NVENC (NVIDIA) always ship; software x264/x265 require your own FFmpeg build.
| Field | Type | Description |
|---|---|---|
| vcodec | string | e.g. hevc_videotoolbox, h264_videotoolbox, hevc_nvenc, prores_ks, libvpx-vp9, libaom-av1, libx265 |
| crf | int | Constant rate factor for software encoders, e.g. 16–23 |
| pix_format | string | e.g. yuv420p, p010le (10-bit), yuv422p10le |
| preset | string | Software-encoder speed preset, ultrafast…veryslow |
| container | string | mp4, mov, mkv, avi, webm |
| color_space / color_primaries / color_trc / color_range | string | HDR/color metadata, e.g. bt2020nc, smpte2084 (PQ), arib-std-b67 (HLG), limited/full |
| field_order | string | progressive (default) or interlaced field orders |
image_output
| Field | Type | Default | Description |
|---|---|---|---|
| format | enum | png | png, jpeg, or tiff |
| output_pattern | string | Filename pattern, e.g. frame_%05d.png | |
| bit_depth | int | 8 or 16 bits per channel (PNG/TIFF) | |
| color_mode | enum | rgb or grayscale | |
| include_alpha | bool | Include an alpha channel (PNG/TIFF) | |
| jpeg_quality / jpeg_subsampling | int / enum | JPEG quality 1–100; chroma subsampling 420/422/444 | |
| png_compression_level / tiff_compression | int / enum | PNG level 0–9; TIFF none/lzw/deflate/packbits |
Per-model blocks
On macOS, each model's coreml block selects compute units: CPU_AND_GPU (default), CPU_AND_NE (Neural Engine), or ALL (run GPU and Neural Engine concurrently where supported).
| Field | Type | Default | Description |
|---|---|---|---|
| refocus.coreml.coreml_compute_type | enum | CPU_AND_GPU | Compute units for the Refocus model. |
| vfi.interpolation_factor | int | 2 | Frame-rate multiplier k — each input pair yields k−1 new frames. |
| vfi.coreml.coreml_compute_type | enum | CPU_AND_GPU | Compute units for frame interpolation; ALL runs dual GPU + Neural Engine inferencers. |
| denoise.coreml.coreml_compute_type | enum | CPU_AND_GPU | Compute units for denoising; ALL runs dual GPU + Neural Engine inferencers. |
| regenerate.minimum_tile_overlap_h / _w | int | 0 | Minimum per-boundary tile overlap (in upscaled pixels) for the Regenerate family — higher values hide tile seams on difficult content. |
| regenerate.decoder | enum | turbo | VAE decoder variant on NVIDIA: turbo (~7× faster) or base. |
| regenerate.coreml.concurrent | bool | false | Regenerate-Q on macOS: run encode/decode on the Neural Engine concurrently with the GPU transformer. |
| regenerate.coreml.transformer_units / vae_encoder_units / vae_decoder_units | enum | Per-component compute-unit overrides for the Regenerate family. | |
| regenerate.cuda.vram_headroom_mib / ram_headroom_mib | int | 4096 | Regenerate-Q on NVIDIA: free-memory margins that control when per-tile state tiers from VRAM to RAM to disk. |
Example: two-stage pipeline (Refocus → Regenerate-Q)
[
{
"id": "clip_stage_1",
"input_path": "footage/clip_270p.mp4",
"output_path": "output/clip_stage_1.mp4",
"model_type": "refocus",
"refocus": { "coreml": { "coreml_compute_type": "ALL" } }
},
{
"id": "clip_stage_2",
"input_path": "output/clip_stage_1.mp4",
"output_path": "output/clip_final.mp4",
"model_type": "regenerate_q",
"scaling": { "upscale_factor": 1 },
"regenerate": {
"minimum_tile_overlap_h": 128,
"minimum_tile_overlap_w": 128,
"coreml": { "concurrent": true }
}
}
]Example: metric depth maps as a 16-bit image sequence
[
{
"id": "clip_depth",
"input_path": "footage/clip.mp4",
"output_path": "output/depth/",
"model_type": "depth_est",
"depth_variant": "metric",
"depth_size": "base",
"output_mode": "image_sequence",
"image_output": {
"format": "png",
"bit_depth": 16,
"color_mode": "grayscale"
}
}
]Engine configuration (app_config.json)
The engine reads a single JSON configuration file, used by rfc start and rfc optimize. Installed location: ~/Documents/RefocusedApp/configs/app_config.json. Every key is optional — missing keys take the defaults below. Edit it directly or with rfc set <dotted.key> <value>, then apply with rfc refresh config or an engine restart.
{
"engines_location": "models/release",
"weights_location": "weights",
"log_level": "WARNING",
"license_file_location": "license/license.rflic",
"engines": { "load_on_startup": [] },
"inference_manager": { "max_engines": 2 },
"pipeline": { "max_active_processing_units": 24 },
"command_interface": { "enabled": true },
"monitoring": {
"enabled": true,
"status_server": { "tcp_port": 8080, "bind_address": "127.0.0.1" }
},
"output": { "enable_history_logging": true }
}Top level
| Key | Type | Default | Description |
|---|---|---|---|
| engines_location | path | Directory the engine scans for built inference engines. | |
| weights_location | path | Directory holding downloaded model weights (used by optimize builds). | |
| log_level | enum | WARNING | DEBUG, INFO, WARNING, or ERROR. |
| license_file_location | path | license.rflic | Path to the device license file. |
engines
| Key | Type | Default | Description |
|---|---|---|---|
| engines.load_on_startup | string[] | [] | Engine categories to preload at startup instead of on first use. |
| engines.overlap_per_inference_batch | int | 0 | Default temporal overlap between inference batches; individual jobs may override. |
| engines.regenerate_defaults.min_tile_overlap_h / _w | int | 0 | Default minimum tile overlaps for the Regenerate family, when jobs don't specify them. |
inference_manager & pipeline
| Key | Type | Default | Description |
|---|---|---|---|
| inference_manager.max_engines | int | Maximum engines loaded simultaneously. Raise it to keep multiple pipeline stages resident at once (costs memory). | |
| inference_manager.max_memory_mb | int | Optional cap on total engine memory. Unset = unlimited. | |
| pipeline.max_active_processing_units | int | 3 | Global backpressure limit on in-flight processing units. Jobs may override. |
command_interface & monitoring
| Key | Type | Default | Description |
|---|---|---|---|
| command_interface.enabled | bool | false | Enable the command API (job submission and control). rfc start enables it automatically. |
| monitoring.enabled | bool | true | Master switch for the monitoring stack (status collection + HTTP status server). |
| monitoring.collection.interval_ms | int | 5000 | Status collection interval in milliseconds. |
| monitoring.status_server.tcp_port | int | 8080 | Port for the local HTTP status/command server. |
| monitoring.status_server.bind_address | string | 127.0.0.1 | Bind address. Localhost-only — non-localhost values are rejected. |
| monitoring.status_server.authentication.enabled / api_key | bool / string | false | Optionally require a Bearer token on API requests. |
| monitoring.status_server.access_control.allowed_ips | string[] | ["127.0.0.1", "::1"] | Allowed client IPs for the status server. |
output
| Key | Type | Default | Description |
|---|---|---|---|
| output.enable_history_logging | bool | true | Write completed jobs to the history log. |
| output.history_log_file | path | Job-history log location. |
Files & troubleshooting
File locations
| File | Description |
|---|---|
| ~/Documents/RefocusedApp/configs/cli_config.json | CLI settings (see rfc set) |
| ~/Documents/RefocusedApp/configs/app_config.json | Engine configuration passed to rfc start |
| ~/Documents/RefocusedApp/rfc/engine_output.log | Engine output when started via rfc start |
| ~/Documents/RefocusedApp/rfc/command_history.log | Interactive command history |
Troubleshooting
"Cannot connect to RefocusedEngine"— the engine isn't running or the command API isn't enabled. Use rfc start.
add fails immediately — check the job file path, and the engine output log for validation errors.
Optimization appears stuck — rfc optimize <type> status includes the tail of the build log; builds can take many minutes.
Questions about the CLI or scripting Refocused?
Submit a support ticket