Media Input Nodes

Applies to: ChengOS v0.2.0+ | Last verified: 2026-09-25 | Source: crates/cheng-nodes/src/nodes/builtin/io

Everything here converts non-text media into text a model can read. Pick by source type: io/document_to_text for documents, io/ocr for images (its mode trades speed against accuracy, from text-layer-only extraction up to the full engine), io/speech_to_text for audio. Video needs two steps — io/video_extract_audio first, then speech-to-text; use io/video_extract_frames when the information is visual rather than spoken. All of them take artifact ports, so wire io/file_upload straight into them rather than passing content inline.

Document To Text — io/document_to_text

Parse PDF, Word, Excel, TXT and other documents to text. Persists the full text as an artifact and returns a bounded preview.

Inputs

FieldTypeRequiredDefaultDescription
artifactobject (port)—nullDocument artifact reference (preferred). Connect from io/file_upload.document_artifact. Connection port, not a form field.
file_pathstring—nullLocal file path (legacy; mutually exclusive with artifact)
base64_contentstring—nullDeprecated inline base64 content; prefer an artifact reference. Control: textarea
filenamestring—nullFilename used to infer format (with base64_content)
max_charsinteger—0Processing cap on extracted characters (0 = unlimited). Not the LLM preview budget. Control: number
preview_bytesinteger—0Bounded UTF-8 preview budget for LLM (default 2 KiB). Full text is still persisted as an artifact. Control: number
max_source_bytesinteger—0Maximum source bytes read before parsing (0 = 25 MiB default). Control: number

Outputs

FieldTypeDescription
text_artifactobject (port)Artifact holding the complete extracted text. Connection port, not a form field.
previewstringBounded UTF-8 preview of the extracted text
source_artifactobjectSource document artifact, if any
char_countintegerCharacters in the full extracted text
formatstringDetected format (pdf/docx/xlsx/txt etc.)
truncatedbooleanWhether the preview is truncated vs full text
warningstring非致命告警(如工件持久化失败)
textstringDeprecated; equals the bounded preview

OCR — io/ocr

Extract text from PDFs, images, and documents using local OCR. Persists full text, regions, layout, and structured results as artifacts; returns a bounded preview and metadata.

Inputs

FieldTypeRequiredDefaultDescription
artifactobject (port)—nullImage/PDF artifact reference (preferred). Connect from io/file_upload.image_artifact or document_artifact. Connection port, not a form field.
files_jsonarray<object> (port)—nullDeprecated browser upload payload; prefer the artifact input. Connection port, not a form field. Control: file-upload
file_pathstring—nullDeprecated local absolute file path on server; prefer the artifact input
base64_contentstring—nullDeprecated inline base64 content; prefer the artifact input. Control: textarea
filenamestring—nullFilename for format detection (used with base64_content)
mime_typestring—nullMIME type override (auto-detected from filename if not provided)
modeenum—autoProcessing mode: Auto, TextPdfOnly, Light (Tesseract), Standard. Control: select. Options: auto (Automatically select the best engine based on input and hardware.), text_pdf_only (Only extract text from electronic PDFs; fail for scanned/image inputs.), light (Use lightweight OCR (Tesseract) even when heavier engines are available.), standard (Use the highest-quality engine available (PaddleOCR ONNX when enabled).)
engineenum—tesseractOCR engine for image/scanned PDF inputs: Tesseract by default, or PaddleOCR ONNX when installed. Control: select. Options: tesseract (Use the Tesseract CLI engine.), paddle_onnx (Use PaddleOCR via ONNX Runtime.)
languageenum—autoLanguage hint: Auto, English, Simplified Chinese, Chinese+English. Control: select. Options: auto (Auto-detect language.), eng (English only.), chi_sim (Simplified Chinese only.), chi_sim_eng (Simplified Chinese + English (mixed).)
max_charsinteger—0Processing cap on extracted characters (0 = unlimited). Not the LLM preview budget. Control: number
preview_bytesinteger—0Bounded UTF-8 preview budget for LLM (default 2 KiB). Full text is still persisted as an artifact. Control: number
min_confidencenumber—0.0Minimum OCR confidence (0.0-1.0), 0 to skip confidence check. Control: number
rules_jsonstring—nullOptional JSON rules for extracting structured fields from OCR text. Control: textarea
max_pagesinteger—0Maximum pages to render for scanned PDFs (0 = default 5, max 50). Control: number
render_dpiinteger—0DPI for rendering scanned PDF pages to images (0 = default 150). Control: number

Outputs

FieldTypeDescription
previewstringBounded UTF-8 preview of the recognized text
text_artifactobject (port)Artifact holding the complete recognized text. Connection port, not a form field.
regions_artifactobject (port)Artifact holding text regions with bounding boxes (JSON). Connection port, not a form field.
layout_artifactobject (port)Artifact holding spatially-reconstructed reading-order text. Connection port, not a form field.
structured_artifactobject (port)Artifact holding structured fields JSON when too large to inline. Connection port, not a form field.
structured_jsonstringSmall structured fields extracted using rules (kept inline; offloaded to structured_artifact when large)
char_countintegerNumber of characters extracted
formatstringDetected input format (pdf/image/text etc.)
enginestringOCR engine used (none/pdf_text/tesseract/paddle_onnx)
confidencenumberOCR confidence score (0.0-1.0)
statusstringResult status: success/partial/failed/unsupported
warningstringWarning about quality, completeness, or artifact persistence
source_artifactobjectSource image/document artifact, if any
textstringDeprecated; equals the bounded preview

Speech To Text — io/speech_to_text

Transcribe audio files to text using OpenAI Whisper API, supports mp3/wav/m4a/ogg/flac/webm formats. Accepts an audio artifact reference (preferred) or local path. Persists the complete transcript as an artifact and returns a bounded preview.

Inputs

FieldTypeRequiredDefaultDescription
llm_configobject (port)✅—LLM config (connect to LLM config node for API Key, Endpoint and model). Connection port, not a form field. Control: text
artifactobject (port)—nullAudio artifact reference (preferred). Connect from io/file_upload.audio_artifact or io/video_extract_audio.audio_artifact. Connection port, not a form field.
artifact_uristring—nullartifact://<id> URI (alternative to artifact; mutually exclusive)
file_pathstring—nullLocal absolute path of the audio file on server (legacy; mutually exclusive with artifact)
base64_contentstring—nullDeprecated inline base64 content; prefer an artifact reference. Control: textarea
filenamestring—nullFilename, required when using base64_content (e.g. audio.mp3)
languagestring—nullAudio language (ISO-639-1, e.g. zh, en), leave empty for auto-detection
promptstring—nullPrompt (optional), helps model recognize specific terms or speaking style. Control: textarea
response_formatenum—textOutput format: text (plain text) / json / verbose_json / srt / vtt. Control: select. Options: text (仅返回纯文本转录), json (返回 JSON(含 segments、duration 等)), verbosejson (返回带时间戳的详细 JSON), srt (SubRip 字幕格式), vtt (WebVTT 字幕格式)
temperaturenumber—0.0Sampling temperature 0.0~1.0, 0 means most deterministic output
preview_bytesinteger—0Bounded UTF-8 preview budget for LLM (default 2 KiB). Full transcript is still persisted as an artifact. Control: number

Outputs

FieldTypeDescription
previewstringBounded UTF-8 preview of the transcript; full text is in transcript_artifact
transcript_artifactobject (port)Artifact holding the complete transcript / provider response body. Connection port, not a form field.
detected_languagestringDetected language code (only available in verbose_json format)
duration_secondsnumberAudio duration in seconds (only available in verbose_json format)
char_countintegerCharacter count of the transcribed text
response_formatstringEchoed response format used by the provider
source_artifactobjectSource audio artifact reference, if any
warningstring非致命告警(如工件持久化失败)
textstringDeprecated; equals the bounded preview

Video Extract Audio — io/video_extract_audio

Extract audio track from video file into a workspace audio artifact (via ffmpeg). Connect to Speech To Text node for transcription. Requires ffmpeg installed on system.

Inputs

FieldTypeRequiredDefaultDescription
artifactobject (port)—nullVideo artifact reference (preferred). Connect from io/file_upload.video_artifact. Connection port, not a form field.
artifact_uristring—nullartifact://<id> URI (alternative to artifact)
file_pathstring—nullLocal absolute path of the video file (legacy; mutually exclusive with artifact)
output_formatenum—wavOutput audio format: wav (recommended) / mp3 / ogg / flac. Control: select. Options: wav (WAV(无损,与 Whisper 兼容性最好)), mp3 (MP3(有损压缩,体积小)), ogg (OGG Vorbis), flac (FLAC(无损压缩))
sample_rateinteger—16000Sample rate (Hz), 16000 recommended for Whisper. Control: number
channelsinteger—1Audio channels: 1=mono (recommended), 2=stereo. Control: number
start_secondsinteger—0Start extraction from this second (0 means from the beginning). Control: number
duration_secondsinteger—0Duration of extracted audio (seconds), 0 means extract to the end. Control: number

Outputs

FieldTypeDescription
audio_artifactobject (port)Extracted audio artifact reference; connect directly to io/speech_to_text.artifact. Connection port, not a form field.
file_sizeintegerSize of the extracted audio file (bytes)
formatstringOutput audio format (wav / mp3 / ogg / flac)
ffmpeg_outputstringBounded ffmpeg stderr output (≤ 8 KiB), for debugging
ffmpeg_output_truncatedbooleanWhether ffmpeg stderr was truncated to fit the diagnostic budget
source_artifactobjectSource video artifact reference, if any

Video Extract Frames — io/video_extract_frames

Extract key frames from video at time intervals. Each frame is persisted as a JPEG artifact; node output stays compact (metadata + artifact references only). Downstream multimodal consumers materialize bytes on demand within configured budgets.

Inputs

FieldTypeRequiredDefaultDescription
artifactobject (port)—nullVideo artifact reference (preferred). Connect from io/file_upload.video_artifact. Connection port, not a form field.
artifact_uristring—nullartifact://<id> URI (alternative to artifact)
file_pathstring—nullLocal absolute path of the video file (legacy; mutually exclusive with artifact)
interval_secondsinteger—5Extract one frame every N seconds, default 5. Control: number
max_framesinteger—20Maximum number of frames to extract, default 20. Control: number
widthinteger—768Output image width (pixels), 0 keeps original width. Control: number
heightinteger—0Output image height (pixels), 0 scales proportionally. Control: number
jpeg_qualityinteger—85JPEG compression quality 1-95, default 85. Control: number
start_secondsinteger—0Start extracting from this second (0 means from the beginning). Control: number
end_secondsinteger—0Stop extracting at this second (0 means to the end of video). Control: number

Outputs

FieldTypeDescription
framesarray<object>Extracted frame list, each frame contains timestamp and a JPEG artifact reference (no inline bytes)
frames_manifestobject (port)Artifact holding the JSON manifest of all extracted frames. Connection port, not a form field.
first_frame_artifactobject (port)Convenience artifact reference for the first extracted frame. Connection port, not a form field.
frame_countintegerActual number of frames extracted
video_duration_secondsnumberTotal video duration (seconds)
source_artifactobjectSource video artifact reference, if any
statusstringResult status: success (all frames extracted) / partial (some frames failed) / failed (no frames extracted)
warningstring非致命告警(如工件持久化失败、个别 ffmpeg 调用失败)。带总预算。
warning_truncatedbooleanWhether the warning was truncated to fit the diagnostic budget

Next steps