Actions7
Compress (Optimize)
AI-generatedSummary
Reduce video file size using Constant Rate Factor (CRF) and encoding presets.
Inputs
- inputSource — Source of the input media file. Options: 'binary' (default) reads from a binary property; 'path' reads from a file path string.
- inputPath — Full absolute path to the input media file. Shown when inputSource is 'path'.
- crf — Constant Rate Factor. 0 is lossless, 23 is default, 51 is worst quality. Range 18-28 is usually best for balance of size and quality.
- preset — Encoding speed vs compression ratio trade-off. Options: ultrafast, superfast, fast, medium, slow, veryslow. Default: medium.
- saveToFile — If true, saves the processed file to disk instead of returning binary data. Default: false.
- filePath — Full absolute path where the file should be saved. Shown when saveToFile is true. Directory must exist and be writable.
- fileName — Optional custom filename (without extension) for binary output. Shown when saveToFile is false. If empty, a UUID is used.
- binaryPropertyName — Name of the binary property containing the media file. Default: 'data'. Shown when inputSource is 'binary', hidden for operation 'merge'.
Output shape
binary|file
If saveToFile is false: returns the compressed media as binary data under the property specified by binaryPropertyName (default 'data'); the workflow item's JSON payload remains unchanged. If saveToFile is true: saves the file to the path specified by filePath and returns an item with json.saved=true and json.outputFilePath set to that path; binary is an empty object {}.
Examples
Example 1: Compress a video from a binary field with default CRF and preset.
inputSource=binary, crf=23, preset=medium, saveToFile=false
Example 2: Compress a video from a file path with low CRF for high quality and save to disk.
inputSource=path, inputPath=/tmp/input.mp4, crf=18, preset=veryslow, saveToFile=true, filePath=/tmp/output/video.mp4