Command Line

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.

01

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.

02

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.

03

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.

04

Command reference

Engine lifecycle

rfc startStart RefocusedEngine in the background (with monitoring and the command API enabled) and connect.
rfc stopStop the engine. In interactive mode, rfc stays open.
rfc shutdownShut down the engine. In interactive mode, also exits rfc.
rfc pausePause job processing.
rfc resumeResume 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
TypeDescription
cml_dynamic / trt_dynamicRefocus super-resolution engines (CoreML on macOS / TensorRT on NVIDIA)
cml_regenerateRegenerate diffusion engine (macOS)
cml_regenerate_q / trt_regenerate_qRegenerate-Q streaming engine
cml_vfi / trt_vfiFrame-interpolation engine
cml_depth_est / trt_depth_estDepth-estimation engine
cml_denoise / trt_denoiseDenoise engine
cml_segment / trt_segmentSAM 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 enginesRescan the engines directory on the running engine — pick up newly installed engines without a restart.
rfc refresh configReload configuration on the running engine.

Device & licensing

rfc deviceidPrint 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 settingTypeDefaultDescription
application_config_pathpathconfigs/app_config.jsonEngine config used by start/optimize
job_history_length0–1001Jobs kept in the history view
refresh_interval_ms100–100001000UI data refresh interval
log_display_lines5–10010Log lines shown for build output
default_display_modeenumhelpoutput, history, or help — tab shown at startup
hosthost/IPlocalhostEngine host (restart rfc to apply)
port1–655358080Engine port (restart rfc to apply)
05

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

FieldTypeDefaultDescription
idstringRequired. Stable job identifier, used in logs, monitoring, and history.
input_pathstringRequired. Input video path — absolute, or relative to the engine working directory.
output_pathstringRequired. Output video path, or output directory when output_mode is image_sequence.
model_typeenumrefocusModel family: refocus, regenerate, regenerate_q, vfi, depth_est, or denoise.
engine_typeenumautoInference backend override (e.g. refocus_cml, regenerate_q_trt). Usually unnecessary — model_type routes the job and the backend is inferred from your platform.
enginestringEngine 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.
scalingobjectUpscale factor and input/output downscales — see below.
encoderobjectVideo encoder settings — see below.
output_modeenumvideovideo or image_sequence.
image_outputobjectImage-sequence settings — see below.
copy_audiobooltrueCopy input audio into the output (stream copy, trimmed to the clip range). Video mode only.
clip_start_frameintFirst input frame to process (inclusive).
clip_end_frameintEnd frame boundary — process only part of the input.
tile_featherbooltrueLinearly blend overlapping tile regions during assembly to soften tile seams. Applies to any tiling model.
sharpen_input / sharpen_outputobjectOptional sharpening before/after enhancement: { "sharpen_factor": 0.5, "sharpen_radius": 50 }.
depth_variantenumrelativeDepth estimation: relative or metric (real-world meters).
depth_sizeenumsmallDepth estimation encoder size: small, base, or large.
denoise_strengthnumber30Denoise sigma on a 0–255 scale. Higher removes more noise at the cost of fine texture.
refocus / regenerate / vfi / denoiseobjectPer-model tuning blocks — see below.

scaling

FieldTypeDescription
upscale_factorintOverall upscale factor, e.g. 2 or 4. Enhancement models run at their native 4×; other factors are reached via downscales.
inputobjectDownscale applied before inference: downscale_factor (e.g. 0.5) or explicit downscale_width/downscale_height. Trades resolution for speed.
outputobjectDownscale 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.

FieldTypeDescription
vcodecstringe.g. hevc_videotoolbox, h264_videotoolbox, hevc_nvenc, prores_ks, libvpx-vp9, libaom-av1, libx265
crfintConstant rate factor for software encoders, e.g. 1623
pix_formatstringe.g. yuv420p, p010le (10-bit), yuv422p10le
presetstringSoftware-encoder speed preset, ultrafastveryslow
containerstringmp4, mov, mkv, avi, webm
color_space / color_primaries / color_trc / color_rangestringHDR/color metadata, e.g. bt2020nc, smpte2084 (PQ), arib-std-b67 (HLG), limited/full
field_orderstringprogressive (default) or interlaced field orders

image_output

FieldTypeDefaultDescription
formatenumpngpng, jpeg, or tiff
output_patternstringFilename pattern, e.g. frame_%05d.png
bit_depthint8 or 16 bits per channel (PNG/TIFF)
color_modeenumrgb or grayscale
include_alphaboolInclude an alpha channel (PNG/TIFF)
jpeg_quality / jpeg_subsamplingint / enumJPEG quality 1–100; chroma subsampling 420/422/444
png_compression_level / tiff_compressionint / enumPNG 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).

FieldTypeDefaultDescription
refocus.coreml.coreml_compute_typeenumCPU_AND_GPUCompute units for the Refocus model.
vfi.interpolation_factorint2Frame-rate multiplier k — each input pair yields k−1 new frames.
vfi.coreml.coreml_compute_typeenumCPU_AND_GPUCompute units for frame interpolation; ALL runs dual GPU + Neural Engine inferencers.
denoise.coreml.coreml_compute_typeenumCPU_AND_GPUCompute units for denoising; ALL runs dual GPU + Neural Engine inferencers.
regenerate.minimum_tile_overlap_h / _wint0Minimum per-boundary tile overlap (in upscaled pixels) for the Regenerate family — higher values hide tile seams on difficult content.
regenerate.decoderenumturboVAE decoder variant on NVIDIA: turbo (~7× faster) or base.
regenerate.coreml.concurrentboolfalseRegenerate-Q on macOS: run encode/decode on the Neural Engine concurrently with the GPU transformer.
regenerate.coreml.transformer_units / vae_encoder_units / vae_decoder_unitsenumPer-component compute-unit overrides for the Regenerate family.
regenerate.cuda.vram_headroom_mib / ram_headroom_mibint4096Regenerate-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"
    }
  }
]
06

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

KeyTypeDefaultDescription
engines_locationpathDirectory the engine scans for built inference engines.
weights_locationpathDirectory holding downloaded model weights (used by optimize builds).
log_levelenumWARNINGDEBUG, INFO, WARNING, or ERROR.
license_file_locationpathlicense.rflicPath to the device license file.

engines

KeyTypeDefaultDescription
engines.load_on_startupstring[][]Engine categories to preload at startup instead of on first use.
engines.overlap_per_inference_batchint0Default temporal overlap between inference batches; individual jobs may override.
engines.regenerate_defaults.min_tile_overlap_h / _wint0Default minimum tile overlaps for the Regenerate family, when jobs don't specify them.

inference_manager & pipeline

KeyTypeDefaultDescription
inference_manager.max_enginesintMaximum engines loaded simultaneously. Raise it to keep multiple pipeline stages resident at once (costs memory).
inference_manager.max_memory_mbintOptional cap on total engine memory. Unset = unlimited.
pipeline.max_active_processing_unitsint3Global backpressure limit on in-flight processing units. Jobs may override.

command_interface & monitoring

KeyTypeDefaultDescription
command_interface.enabledboolfalseEnable the command API (job submission and control). rfc start enables it automatically.
monitoring.enabledbooltrueMaster switch for the monitoring stack (status collection + HTTP status server).
monitoring.collection.interval_msint5000Status collection interval in milliseconds.
monitoring.status_server.tcp_portint8080Port for the local HTTP status/command server.
monitoring.status_server.bind_addressstring127.0.0.1Bind address. Localhost-only — non-localhost values are rejected.
monitoring.status_server.authentication.enabled / api_keybool / stringfalseOptionally require a Bearer token on API requests.
monitoring.status_server.access_control.allowed_ipsstring[]["127.0.0.1", "::1"]Allowed client IPs for the status server.

output

KeyTypeDefaultDescription
output.enable_history_loggingbooltrueWrite completed jobs to the history log.
output.history_log_filepathJob-history log location.
07

Files & troubleshooting

File locations

FileDescription
~/Documents/RefocusedApp/configs/cli_config.jsonCLI settings (see rfc set)
~/Documents/RefocusedApp/configs/app_config.jsonEngine configuration passed to rfc start
~/Documents/RefocusedApp/rfc/engine_output.logEngine output when started via rfc start
~/Documents/RefocusedApp/rfc/command_history.logInteractive 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