Skip to content

Pipeline execution contracts ​

For contributors implementing processors, persistence, or recovery. User-facing file routing and failure behavior are in the workflow guide.

Processor Result Contracts ​

Media processors share output planning, sequential execution and single-file skip result construction. Unary audio, metadata, thumbnail and remux jobs use the first output override; their batch jobs require one override per input or none. ASS and DanmakuFactory instead map strictly against selected video/XML inputs. Naming and empty-string policies remain processor-specific.

Audio, metadata, thumbnail and remux use staged publication through the shared driver: every output of a job is written to a temporary file and the whole batch is published together, so a failure or cancellation part-way through a batch publishes nothing, and one item's output can never overwrite another item's input. ASS retains its artifact-matching loop and the same staged publication. Source deletion remains after successful publication, and skipped sources remain. Outputs, succeeded/skipped inputs and logs retain their input order and existing metadata shapes. Batch jobs report the summed input and output sizes of the items they processed.

A processor that reports some of its inputs as failed fails the job, and a workflow step with it, even when the remaining inputs were processed. The error names each failed input. What was published stays on disk and in the job's produced-file history, so a retry resumes past it. An rclone move or BaiduPCS upload that fails part-way records each file's own result instead of marking every file failed. Copy and move steps refuse two inputs that would use the same destination name, and a thumbnail step takes the first frame of a recording shorter than the requested timestamp.

Path mechanisms share filesystem resolution while preserving separate policies: ASS command spelling remains lexical; remux resolves existing relative command paths and uses best-effort, Windows/macOS case-folded comparisons. Staged output validation checks native identity (including hard links), resolves nonexistent leaves through their parents, and propagates I/O errors. Transfer processors still capture sizes before sources can be consumed and treat only confirmed absence as an earlier completed transfer.

Restart recovery of danmu segments ​

Recovery associates a stored XML output with the stored video segment whose path has the same name with its extension replaced by .xml. The stored paths must match; recovery does not infer an index from title digits or media-output IDs. If no segment matches, or different segment indices produce the same XML path, the XML output is skipped with a warning. Keep original video/XML path records consistent when restoring a database; unmatched historical files are not automatically assigned to a segment or replayed through paired processing.

Error Handling ​

Paired-segment and session-complete pipelines receive their video inputs first, followed by their danmaku inputs. Session-complete inputs are ordered by segment index; paired inputs retain their collected order. Which danmaku file belongs to which video is recorded per segment as the pipeline's session pairing, stored with the pipeline itself and available to every step, including after a restart or retry. Subtitle conversion and burn-in pair within a segment only: a segment without a danmaku file leaves its own video without subtitles and does not shift the pairing of later segments. A subtitle is burned into one video per job; a second copy of the same recording in the same job is passed through with a note. No file is written next to the recordings; _inputs.json files left by earlier versions are unused and can be deleted.

Normal completion and restart recovery collect leaf outputs in DAG definition order, keeping the first occurrence of each path with case folding on Windows and macOS. Missing leaf records or malformed output arrays leave recovery incomplete while preserving the valid outputs. Completing a step twice does not create another downstream job or increment the DAG's completed-step count again.

Delete, rclone and BaiduPCS retry delays grow exponentially but are capped at 30 seconds per wait, including extreme configured values. Retry counts keep their configured meaning. Before each rclone or BaiduPCS upload retry, the job log notes the failed attempt and the wait, and the job's progress reports the retrying phase, without bytes, speed or eta_secs, until the next attempt starts. From the first retry on, snapshots carry attempt and max_attempts: the upload's own attempt within one job run, separate from the job's retry count. FFmpeg progress timestamps exposed as out_time_ms are milliseconds for both supported upstream timestamp keys. duration_ms is the length the run writes: the input length FFmpeg reports, shortened by remux trimming. percent and eta_secs follow from it, and percent stays below 100 until FFmpeg reports the end. Multi-file jobs report files_done and files_total; FFmpeg steps leave out inputs they pass through by file type, such as danmu XML. The percent of a multi-file FFmpeg or DanmakuFactory job covers the whole job with an equal share per file, while out_time_ms and duration_ms describe the file in progress. eta_secs covers only that file, so FFmpeg jobs report it only for their last file. DanmakuFactory reports no progress within a file, so its jobs show only the file they have reached. Copy and move jobs count bytes across the whole job, leaving excluded inputs out of both bytes and files: bytes_done, bytes_total and percent cover every file the job copies or moves, the speed is that of the file being copied, and eta_secs is the time the job's remaining bytes take at that speed. Compression jobs count bytes across the whole job too; their speed is the average since the job started, and eta_secs the time the remaining bytes take at that speed. BaiduPCS uploads count bytes and files across the whole job as well, starting from the files earlier attempts of the same run uploaded, and report at most once a second; their speed is the sum of the files BaiduPCS-Go uploads at once. phase is absent while a job does plain work towards percent. It is finalizing while FFmpeg rewrites an MP4 after writing its last frame, such as moving the index to the front for fast start; percent then stops at 99% of the file's share, with no speed or eta_secs, until FFmpeg reports the end. It is also finalizing for an rclone job that sent every byte while the destination confirms the files in flight. It is preparing for a BaiduPCS upload while none of the files BaiduPCS-Go is working on has shown progress yet, because before sending a file BaiduPCS-Go checks the Netdisk and hashes the file without progress output; the job's counts so far stay. It is also preparing for an rclone job while none of the files in flight has sent data, such as while rclone hashes a file for a destination that stores a checksum with the upload (S3 multipart uploads, for example), and before its first transfer, while rclone lists the destination and compares the files already there, which can mean reading a whole file to compare checksums. FFmpeg, copy, compression, DanmakuFactory, rclone and BaiduPCS jobs name the file in progress in current_file, without its directories; rclone and BaiduPCS jobs name none while they send several files at once. raw carries no file paths.

Job progress is kept in memory only. A job has no snapshot until it reports, including after a restart, and loses it when it ends; GET /api/pipeline/jobs/{id}/progress returns 404 without one.

Staged outputs with overwrite disabled use native no-replace publication on Windows, Linux and macOS, so a filesystem without hard links can still publish without overwriting a competing file. Systems that support neither no-replace publication nor hard links return an error. Temporary-file cleanup after an abandoned processor runs off the async worker and is best effort; a normal publication waits for its commit or rollback. Subtitle and font paths support apostrophes and filtergraph delimiters without extra user escaping.

  • Fail-fast: When a step fails, only the steps that depend on it, directly or through other steps, are cancelled. Steps on independent branches keep running and finish normally; the workflow stays in progress, with the failure recorded as its error, until no step is running, and is then marked failed. A retry re-runs only the failed and cancelled steps.
  • Retry: Failed steps can be retried manually or automatically. A retry checks every job it will restart before changing anything; if restarting breaks down part-way, the workflow is failed again with the retry error and stays retryable. A workflow whose cancelled step never received a job can be retried too. At startup, a running step whose job had already failed or been cancelled fails its workflow so it can be retried.
  • Logs: Each step maintains execution logs for debugging

Retries and restart recovery retain the job's earlier step timings, log counters, file-size metadata and produced-artifact history. Starting another attempt does not duplicate earlier log entries. The current processor is saved before it runs; if that write fails or stored execution metadata is invalid, processing stops and the failure is reported without replacing the original metadata. Completion and failure updates also preserve additional stored execution-metadata fields.

Produced-artifact history can include files published by earlier attempts. A later failure does not delete those files. Processors manage their own staged temporary outputs, with the cleanup limits described above.

Released under the MIT / Apache-2.0 License.