FFmpeg Exec icon

FFmpeg Exec

直接执行输入的FFmpeg命令,不做任何修改

Overview

This node allows users to directly execute FFmpeg commands within an n8n workflow. It can either preview the FFmpeg command or run it immediately, providing a flexible way to integrate video/audio processing tasks without modifying the original command syntax.

Common scenarios include:

  • Automating video transcoding or compression by running custom FFmpeg commands.
  • Generating previews of FFmpeg commands before actual execution for validation.
  • Monitoring long-running FFmpeg processes with progress callbacks.
  • Managing multiple FFmpeg tasks distinguished by unique task IDs.

Practical example:

  • A user wants to compress a video file using ffmpeg -i input.mp4 -c:v libx264 -crf 23 output.mp4. They can input this command, choose to execute it immediately, and optionally receive progress updates via a callback URL.

Properties

Name Meaning
FFmpeg命令 (originalCommand) The FFmpeg command string to be executed. Example: ffmpeg -i input.mp4 -c:v libx264 -crf 23 output.mp4. This is required.
执行命令 (executeCommand) Boolean flag indicating whether to execute the command immediately (true) or just preview it (false).
进度回调URL (progressCallbackUrl) Optional HTTP POST URL to receive FFmpeg progress updates during execution.
进度报告间隔 (毫秒) (progressInterval) Interval in milliseconds at which progress updates are sent to the callback URL. Only active if a callback URL is set.
任务ID (taskId) Unique identifier string for the FFmpeg task instance, used to distinguish different tasks in progress callbacks.
任务执行超时时间 (分钟) (timeout) Timeout duration in minutes after which the FFmpeg process will be forcibly terminated if not completed. Range: 1–1440.

Output

The node outputs JSON objects for each input item processed, containing:

  • success: Boolean indicating if the command was successfully executed.
  • originalCommand: The original FFmpeg command string.
  • command: The same as the original command.
  • executed: Boolean indicating if the command was actually run (true) or only previewed (false).
  • taskId: The unique task identifier provided.
  • progressCallbackUrl: The callback URL if set.
  • progressInterval: The interval for progress updates.
  • finalStatus: Final status of the FFmpeg task (completed, failed, cancelled), present if executed.
  • taskCancelled: Boolean indicating if the task was cancelled.
  • executionError: Error message if execution failed.
  • stderr: Standard error output from FFmpeg process.
  • outputExists: Boolean indicating if the expected output file exists after execution.

If execution fails or the command is invalid, the output contains an error field with a descriptive message.

The node does not output binary data.

Dependencies

  • Requires FFmpeg installed and accessible in the system environment where n8n runs.
  • Optionally requires an HTTP endpoint to receive progress callbacks if progressCallbackUrl is set.
  • No internal credential types are exposed; however, network access may be needed for callback URLs.
  • Uses internal helper methods to send HTTP POST requests for progress and completion notifications.

Troubleshooting

  • Empty Command: If the FFmpeg command string is empty or whitespace, the node throws an error "FFmpeg命令不能为空" ("FFmpeg command cannot be empty").
  • Execution Failures: Errors during FFmpeg execution (e.g., invalid command syntax, missing input files) result in failure messages including the original command and error details.
  • Timeouts: If the FFmpeg process exceeds the specified timeout, it is forcibly terminated, which may cause incomplete output or errors.
  • Progress Callback Failures: If the progress callback URL is unreachable or returns errors, these are logged but do not stop the node execution.
  • Continue On Fail: If enabled, the node continues processing subsequent items even if one fails; otherwise, it stops on first error.

To resolve issues:

  • Verify the correctness of the FFmpeg command syntax.
  • Ensure input/output file paths are correct and accessible.
  • Confirm the FFmpeg binary is installed and in PATH.
  • Check network connectivity and availability of the progress callback URL.
  • Adjust timeout settings according to expected processing time.

Links and References

Discussion