Skip to content
falang.ioRU

Media

The Media integration processes images, video and audio with ffmpeg — resize a photo, make a thumbnail, trim or stitch clips, convert a voice message before transcribing it. Every action takes and returns a File reference, never raw bytes: the work happens on a separate, dedicated service, not inside your scenario’s own process. No credentials are needed — it’s available to every scenario the moment the project exists.

  • Probe. Reads a file’s duration, width/height, video/audio codec, bitrate and MIME type without changing anything — the usual first step before deciding what to do with a file whose shape you don’t already know (e.g. a photo of unknown size someone sent).

  • Resize image. Fits an image inside a given width/height (or crops to exactly fill it), with a target format (keep the original, JPEG, PNG or WebP) and quality.

  • Convert image. Changes an image’s format and quality without resizing.

  • Trim video. Cuts a clip starting at a given time, for a given duration — a fast stream copy by default (no re-encoding), or a full re-encode when the cut needs to land exactly on a non-keyframe boundary.

  • Concatenate video. Joins several clips into one, in order — a fast copy when every input already shares the same codec/resolution, or a re-encode when they don’t.

  • Video thumbnail. Grabs a single frame at a given time as a JPEG image, with an optional target width.

  • Transcode video. Re-encodes a video to one of a few fixed presets (web-friendly 720p/1080p, a Telegram-sized preset, or an animated GIF) and a target container format.

  • Extract audio. Pulls the audio track out of a video file as MP3, AAC, WAV or Ogg.

  • Convert audio. Changes an audio file’s format, bitrate, channel count (mono/stereo) and sample rate — the usual step before Call AI (transcribe), since a Telegram voice message arrives as Ogg/Opus and some transcription backends want something else.

  • Telegram voice message → text. message.voice is already a File — run Convert audio (to MP3 or WAV) on it, then pass the result to Call AI (transcribe).

  • Incoming photo → a smaller copy sent back. Probe the incoming message.photo to check its size, Resize image it down (e.g. to fit inside 800×800 as WebP), then Send file the result back to the chat.

  • Video upload → a preview. Probe for duration, Video thumbnail at a fixed timestamp (or a fraction of the duration) for a preview image, and Transcode video to a web-friendly preset before publishing.

Every operation is a long-running, heartbeating step rather than a quick call — a transcode or a large concat can take minutes, and the platform reports progress and lets it be cancelled while it runs (e.g. if the scenario itself is stopped) rather than blocking with no feedback. Inputs are checked against their real container/codec before any processing starts, so an unsupported or corrupt file is rejected early rather than fed to a decoder. Only a fixed set of operations is exposed — there’s no free-form access to ffmpeg’s own command-line options.