exec_static

The exec_static directive allows the NGINX RTMP module to execute external programs upon specific streaming events.

Syntaxexec_static command [args];
Defaultnone
Context
Arguments1+

Description

The 'exec_static' directive is part of the NGINX RTMP module, providing the capability to invoke external applications or scripts in response to certain RTMP events, such as stream publishing or closing. This directive can take one or more arguments that specify the command to be executed along with any necessary parameters. This feature is useful for integrating additional processing, such as transcoding, logging, or triggering other operations at the network edge without complicating the main application logic in NGINX.

Usage of this directive can enhance server flexibility but requires careful management of the external executable's behavior and performance impact on the streaming process. Each command specified may also have specific access rights or environmental dependencies which need to be ensured for successful execution during runtime. Developers can define actions that should happen as a stream is published or when clients connect, offering extensive possibilities for dynamic responses to media events.

Config Example

application live {
    live on;
    exec_static /path/to/script.sh arg1 arg2;
}

Ensure the external command is executable and has proper permissions set; otherwise, the server will not be able to execute it.

Check for correct command output handling; NGINX may not process output from commands unless specified in the program.

Avoid intensive processing in the executed program as it may block the streaming service and affect performance.

← Back to all directives