compress

This block is part of the video group and was last modified in core v15.0.0.

compress v15.0.0

Compresses a video file with ffmpeg as a background queue job. Use a preset for standard message-media output, or override individual settings. Wire on_complete_function / on_error_function to react to the result.

In pins 12 + flow
  • flow
    flow
  • file required
    value

    Input video file. Accepts a file object (from another file block) or a relative path string.

  • preset required
    value

    One of: mssgs_media (1280px, 2.5Mbps), mssgs_media_premium (1920px, 4Mbps), custom.

    Default mssgs_media

  • output file
    value

    Optional output path. When empty, a hash-named .mp4 is generated alongside the input.

  • max size
    number

    Override longest-side cap. Set to 0 to disable scaling.

  • video bitrate
    value

    Override target video bitrate, e.g. "2500k".

  • max rate
    value

    Override VBV ceiling, e.g. "3000k".

  • buf size
    value

    Override VBV buffer, e.g. "6000k".

  • audio bitrate
    value

    Override audio bitrate, e.g. "128k".

  • fps
    number

    Override target frames per second.

  • passthrough
    value

    Arbitrary data forwarded verbatim to the callback function's passthrough inpin.

  • wait in flow
    condition

    When true, the block blocks until the compression job finishes and populates the result outpins synchronously. Default false : the flow continues immediately and the callback function handles the result.

  • wait timeout (s)
    number

    How long to wait when wait_in_flow=true before giving up with WAIT_TIMEOUT.

    Default 300

Out pins 10 + flow
  • flow
    flow
  • queue guid
    value

    GUID of the enqueued compression job. Feed this to function_wait_for_queue_item or use for cancellation.

  • output file
    value

    Path where the compressed file will be written when the job runs.

  • width
    number

    Output width in pixels : populated only when wait_in_flow=true.

  • height
    number

    Output height in pixels : populated only when wait_in_flow=true.

  • duration ms
    number

    Output duration in milliseconds : populated only when wait_in_flow=true.

  • size bytes
    number

    Output file size in bytes : populated only when wait_in_flow=true.

  • success
    condition

    Whether compression succeeded : populated only when wait_in_flow=true.

  • error
    value

    Set when enqueueing fails synchronously, when wait_in_flow times out, or when the ffmpeg job fails (only with wait_in_flow=true). When wait_in_flow=false, ffmpeg errors flow to on_error_function.

  • on complete
    execute_function

    Function invoked when compression succeeds. Fires regardless of wait_in_flow.

  • on error
    execute_function

    Function invoked when compression fails. Fires regardless of wait_in_flow.

video compress
ffmpeg
transcode

A function trigger starts the flow and compress transcodes the file from the file pin using the preset pin. Both pins take plain values here, from value blocks. Compression runs in the background; the queue guid, dimensions and success pins report back when done.

Studio canvas example for the compress block: compressing an uploaded video.

Version history

Introduced in v15.0.0.


Back to video Return to the main group to view all sub-groups Back to video Return to the group to view all blocks within this group