Actions13
- Video Actions
- Audio Actions
- Text Actions
- Image Actions
- Font Actions
Overview
The node "MediaFX" provides advanced video processing capabilities using FFmpeg, focusing here on the Text - Add Subtitle operation. This operation allows users to add subtitle files to a video source, customizing font, size, color, outline, and positioning of the subtitles.
Common scenarios where this node is beneficial include:
- Adding external subtitle files (e.g., SRT) to videos for accessibility or localization.
- Customizing subtitle appearance to match branding or style guidelines.
- Automating batch processing of videos with subtitles in workflows.
Practical example:
- A user has a video file hosted at a URL and an SRT subtitle file also accessible via URL. They want to embed the subtitles into the video with white text, a specific font, and positioned at the bottom center with padding. This node can take both sources, apply the subtitles with the specified styling, and output the processed video.
Properties
| Name | Meaning |
|---|---|
| Video Source | The input video to which subtitles will be added. Can be provided as a URL or binary data from previous nodes. |
| Subtitle File Source | The subtitle file to overlay on the video. Supports URL or binary data input. |
| Font Key | The font used for rendering the subtitle text. Options are dynamically loaded from available fonts (including user-uploaded fonts). Default is "noto-sans-kr". |
| Font Size | Size of the subtitle text in pixels. Default is 48. |
| Color | Text color of the subtitles. Accepts color names (e.g., "white", "red") or hex codes (e.g., "#FF0000"). Default is "white". |
| Outline Width | Width of the text border/outline around the subtitles. Default is 1 pixel. |
| Position Type | How the subtitle text is positioned on the video. Two options: • Alignment — use preset horizontal and vertical alignments. • Custom — specify exact X/Y coordinates using FFmpeg expressions. |
| Horizontal Alignment | When using alignment positioning, sets horizontal position: Left, Center, or Right. Default is Center. |
| Vertical Alignment | When using alignment positioning, sets vertical position: Top, Middle, or Bottom. Default is Bottom. |
| Horizontal Padding | Padding in pixels from the left/right edges when using alignment positioning. Default is 20. |
| Vertical Padding | Padding in pixels from the top/bottom edges when using alignment positioning. Default is 20. |
| Position X | When using custom positioning, the X coordinate expression for subtitle placement. Supports FFmpeg expressions like (w-text_w)/2. Default is (w-text_w)/2 (center horizontally). |
| Position Y | When using custom positioning, the Y coordinate expression for subtitle placement. Supports FFmpeg expressions like h-th-50. Default is h-th-50 (near bottom). |
Output
The node outputs the processed video file with subtitles embedded as binary data under the property data. The output item contains:
json: An empty object{}(no additional JSON metadata).binary.data: The resulting video file with subtitles applied.pairedItem.item: The index of the input item this output corresponds to.
This binary output can be passed to subsequent nodes for storage, upload, or further processing.
Dependencies
- Requires FFmpeg installed and accessible in the environment where n8n runs.
- Uses an API key credential or similar authentication if video or subtitle URLs require authorization (not shown explicitly but typical for URL fetching).
- Relies on internal helper functions to resolve inputs from URLs or binary data.
- Dynamically loads available fonts from the system or user uploads.
Troubleshooting
- No binary data found in property 'X': Occurs if the specified binary property does not exist on the input item. Ensure the binary property name matches exactly.
- Font file not found at path: If uploading a font from a local path, verify the file exists and the path is correct.
- Operation did not produce an output: Indicates the FFmpeg command failed or no output file was generated. Check input sources and parameters.
- FFmpeg errors: May occur if expressions for positioning are invalid or unsupported by the FFmpeg version. Validate expressions and ensure FFmpeg is up to date.
- Cleanup failures: Temporary files cleanup errors are caught silently; however, persistent temp files may accumulate if the node crashes before cleanup.
To resolve issues:
- Verify all input URLs or binary data are accessible and valid.
- Confirm font keys correspond to installed or uploaded fonts.
- Use simple positioning expressions initially to isolate errors.
- Check FFmpeg installation and version compatibility.
Links and References
- FFmpeg Documentation - Subtitles
- FFmpeg Expression Evaluation
- SRT Subtitle Format
- n8n Documentation - Working with Binary Data
- Fonts in FFmpeg (for font selection and usage)
