Constants
constants
¶
Defines deterministic constants and built-in default values for the server
Configuration Split
Environment-dependent configuration is resolved lazily by
mirumoji.server.config.get_settings so that a .env loaded at
startup is respected
Attributes:
| Name | Type | Description |
|---|---|---|
DB_URL |
str
|
Async SQLAlchemy database URL built from |
DEFAULT_SRT_SYS_MSG |
str
|
Built-in default system message for SRT-fixing |
DEFAULT_BREAKDOWN_SYS_MSG |
str
|
Built-in default system message for word-nuance breakdowns |
CONVERSION_PRESETS = {'performance': {'x264': ('veryfast', '26'), 'nvenc': ('p2', '30')}, 'balanced': {'x264': ('medium', '23'), 'nvenc': ('p4', '26')}, 'quality': {'x264': ('slow', '20'), 'nvenc': ('p6', '22')}}
module-attribute
¶
FFmpeg encoder arguments used when converting video to MP4
A dictionary containing bundles of ffmpeg encoder arguments keyed by the name of a specific preset
Format
Each value is (speed, quality) for one encoder
- libx264 -> (-preset, -crf)
- h264_nvenc -> (-preset, -cq)
performance
- Prioritises conversion speed over output quality
- The fastest encoder presets paired with a lower quality target, for when throughput matters more than fidelity
balanced
- Balances conversion speed with output quality
- The default, with mid-range encoder presets and a moderate quality target that suits most playback
quality
- Prioritises output quality
- The slowest encoder presets paired with a higher quality target, for when fidelity matters more than encode time
resolution and target_bitrate options stay separate (output geometry and a
rate ceiling), so a preset only trades encode speed against quality
DEFAULT_CONVERSION_PRESET = 'balanced'
module-attribute
¶
The conversion preset used when a request does not specify one
Names a key of CONVERSION_PRESETS
DEFAULT_MODAL_SCALEDOWN_WINDOW = 60
module-attribute
¶
Default number of seconds an idle Modal GPU container is kept warm before it
scales down
Matches Modal's own default. Raising it (via MIRUMOJI_MODAL_SCALEDOWN_WINDOW)
keeps a container warm longer, so back-to-back jobs skip the cold start at the
cost of more idle GPU time
MAX_LLM_CONCURRENCY = 4
module-attribute
¶
Default number of LLM requests executed simultaneously when requesting an
SRT Fix for a batch of files
Overridable at runtime with MIRUMOJI_MAX_LLM_CONCURRENCY
MODEL_DOWNLOAD_BACKOFF_BASE = 2.0
module-attribute
¶
Base number of seconds for the exponential backoff between Whisper model download retries
MODEL_DOWNLOAD_RETRIES = 4
module-attribute
¶
How many times to attempt loading the local Whisper model before giving up
The first load pulls the weights from the Hugging Face Hub, so transient network failures are retried (the partial download resumes between attempts)