Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from NGINX-RTMP, support exec #367

Closed
winlinvip opened this issue May 16, 2015 · 16 comments
Closed

Migrate from NGINX-RTMP, support exec #367

winlinvip opened this issue May 16, 2015 · 16 comments
Assignees
Labels
Feature It's a new feature. TransByAI Translated by AI/GPT.
Milestone

Comments

@winlinvip
Copy link
Member

https://github.com/winlinvip/simple-rtmp-server/issues/367

@winlinvip winlinvip added the Feature It's a new feature. label May 16, 2015
@winlinvip winlinvip added this to the srs 3.0 release milestone May 16, 2015
@winlinvip
Copy link
Member Author

winlinvip commented Aug 23, 2015

This wiki discusses the handling of the exec signal SIGTERM.
https://github.com/arut/nginx-rtmp-module/wiki/Exec-wrapper-in-bash

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Aug 23, 2015

This mentions executing "exec_record_done" when the DVR ends, adding metadata to the FLV file.
https://github.com/arut/nginx-rtmp-module/wiki/FAQ#seek-does-not-work-with-flv-files-recorded-by-the-module

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Aug 23, 2015

exec is mainly introduced in this wiki: https://github.com/arut/nginx-rtmp-module/wiki/Directives#exec

'
Please make sure to maintain the markdown structure.

TRANS_BY_GPT3

@winlinvip winlinvip changed the title [ 功能修改 ] 建议引入 exec (执行本地可执行程序)功能。 Migrate from NGINX-RTMP, support exec Aug 23, 2015
@winlinvip
Copy link
Member Author

winlinvip commented Aug 23, 2015

https://github.com/arut/nginx-rtmp-module/wiki/Directives#exec_push

exec_push command arg*

Specifies external command with arguments to be executed on every stream published. When publishing stops the process is terminated.

NGINX-RTMP is a program that is executed during streaming and sends a quit signal to the program when the streaming ends.

The available variables include:

$name - stream name
$app - application name
$addr - client address
$flashver - client flash version
$swfurl - client swf url
$tcurl - client tc url
$pageurl - client page url

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Aug 23, 2015

https://github.com/arut/nginx-rtmp-module/wiki/Directives#exec_pull

exec_pull command arg*

Specifies external command with arguments to be executed on play event. The command is executed when first client connects to the stream and is killed when the last one disconnects. This directive makes it possible to pull remote stream in any format for local clients.

When the first client starts playing, the process is initiated. The program ends when the last client exits.

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Aug 23, 2015

https://github.com/arut/nginx-rtmp-module/wiki/Directives#exec_static
Ingest can be considered as an implementation of this feature.

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Aug 23, 2015

https://github.com/arut/nginx-rtmp-module/wiki/Directives#respawn
NGINX-RTMP will restart the process when the process exits while the stream is still active.

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Aug 23, 2015

https://github.com/arut/nginx-rtmp-module/wiki/Directives#exec_record_done
Command executed upon completion of the DVR.

recorder - recorder name
path - recorded file path (/tmp/rec/mystream-1389499351.flv)
filename - path with directory omitted (mystream-1389499351.flv)
basename - file name with extension omitted (mystream-1389499351)
dirname - directory path (/tmp/rec)

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Aug 23, 2015

It seems that these exec commands only need to support two options:

  1. exec: Start a process when the streaming starts.
  2. exec_on_dvr: Also known as exec_record_done, start a program when the recording is completed.

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Aug 23, 2015

https://github.com/arut/nginx-rtmp-module/wiki/Directives#on_record_done
NGINX-RTMP also provides HTTP callbacks, similar to SRS's on_dvr.

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

winlinvip commented Aug 23, 2015

I haven't decided whether to support exec yet, so let's put this feature on hold.

TRANS_BY_GPT3

@winlinvip winlinvip modified the milestones: srs 3.0 release, srs 4.0 release Aug 23, 2015
@winlinvip
Copy link
Member Author

winlinvip commented Aug 23, 2015

This feature indeed compromises the integrity of SRS. There is no need to support a broad feature when HTTP callback can completely replace it and is more flexible. Let's postpone this to SRS4.

TRANS_BY_GPT3

@winlinvip winlinvip modified the milestones: srs 3.0 release, srs 4.0 release Aug 23, 2015
@winlinvip
Copy link
Member Author

winlinvip commented Aug 23, 2015

Still, let's stick with SRS3.

TRANS_BY_GPT3

@winlinvip
Copy link
Member Author

# the vhost for exec, fork process when publish stream.
vhost exec.srs.com {
    # the exec used to fork process when got some event.
    exec {
        # whether enable the exec.
        # default: off.
        enabled     off;
        # when publish stream, exec the process with variables:
        #       [vhost] the input stream vhost.
        #       [port] the intput stream port.
        #       [app] the input stream app.
        #       [stream] the input stream name.
        #       [engine] the tanscode engine name.
        # other variables for exec only:
        #       [url] the rtmp url which trigger the publish.
        #       [tcUrl] the client request tcUrl.
        #       [swfUrl] the client request swfUrl.
        #       [pageUrl] the client request pageUrl.
        # @remark empty to ignore this exec.
        publish     ./objs/ffmpeg/bin/ffmpeg -f flv -i [url] -c copy -y ./[stream].flv;
    }
}

@wanghuan578
Copy link

wanghuan578 commented Jul 18, 2017

Has the 'exec' function been added?

TRANS_BY_GPT3

@winlinvip winlinvip self-assigned this Aug 26, 2021
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature It's a new feature. TransByAI Translated by AI/GPT.
Projects
None yet
Development

No branches or pull requests

2 participants