exec_options

The exec_options directive in the NGINX RTMP module specifies execution options for live streaming and recording events.

Syntaxexec_options command;
Defaultnone
Context
Arguments1

Description

The exec_options directive allows the configuration of execution behaviors when specific streaming actions occur within an RTMP application setup. For instance, this directive lets users define shell command executions in response to certain events, such as starting or stopping streaming sessions. This capability facilitates integration with external processes, enabling developers to invoke scripts or applications automatically based on real-time events, thereby allowing for more dynamic streaming solutions.

When used, the exec_options directive typically takes one argument that specifies the command to be executed. For example, this could include a path to a shell script or a specific command-line instruction that is executed when a particular RTMP event occurs. The command can include variables related to the streaming session, which can be passed to the executed program to provide context about the stream’s state or metadata.

The proper functioning of the exec_options directive also requires careful error handling, as issues in the executed command can impact the stability of the streaming server. It is essential for users to validate their commands thoroughly and ensure they can be executed without causing failures in the overall RTMP server operation. This context-specific execution capability can greatly enhance the server's flexibility and performance, making it a valuable feature for developers and system administrators involved in media streaming applications.

Config Example

application live {
    live on;
    exec_options /path/to/script.sh;
}

Ensure the command is executable and has proper permissions set.

Paths specified should be absolute paths to avoid execution errors.

Test the script separately to confirm it behaves as expected before integrating with NGINX.

← Back to all directives