Video Live VOD NGINX-RTMP Development manual Chinese version

Source: Internet
Author: User
Tags manual socket

August 18, 2016 12:42:35 refer to official document Https://github.com/arut/nginx-rtmp-module/wiki/Directives

Please note that this is a coarse translation, only for reference, not to be updated after the fine school edition

Directory core RTMP Server Listen application timeout ping ping_timeout max_streams ack_window chunk_size max_queue max_message buf Len Out_queue out_cork access permission allow deny Exec a cluster function (the process tends to call one of the Exec functions to execute another program) Exec_push exec_pull Exec exec_options Exec_stati C exec_kill_signal respawn respawn_timeout exec_publish exec_play exec_play_done exec_publish_done Exec_record_done Live Live meta Interleave wait_key wait_video publish_notify drop_idle_publisher sync play_restart idle_streams recording record Recor D_path record_suffix record_unique record_append record_lock record_max_size record_max_frames record_interval Recorder record_notify Video on Demand
Play Play_temp_path Play_local_path relay pull push push_reconnect session_relay notification on_connect on_play on_publish on_done on_ Play_done on_publish_done on_record_done on_update notify_update_timeout notify_update_strict notify_relay_redirect Notify_method HLS Protocol HLS hls_path hls_fragment hls_playlist_length hls_sync hls_continuous hls_nested hls_base_url Hls_ Cleanup hls_fragment_naming hls_fragment_naming_granularity hls_fragment_slicing hls_variant hls_type hls_keys Hls_ Key_path hls_key_url Hls_fragments_per_key Mpeg-dash (http dynamic adaptive streaming) DASH Dash_path dash_fragment dash_playlist_length dash_nested dash_cleanup Access log access_log log_format Limits limit max_connections data statistics Rtmp_stat rtmp_stat_stylesheet Multi-w Orker live streaming multi-threaded live stream Rtmp_auto_push rtmp_auto_push_reconnect rtmp_socket_dir control Module Rtmp_control

The context can be understood as the default configuration file or parameter, and if not, it will be an error, because each function requires some defined parameters and parameters of the incoming function, some of which may be less, but some are necessary core

Syntax: rtmp {...}
Context: Root

Declaring a rtmp server instance

rtmp {
  server {
  }
}

Syntax: Listen (addr[:p ort]|port|unix:path) [bind] [Ipv6only=on|off] [so_keepalive=on|off|keepidle:keepintvl:keepcnt| Proxy_protocol]
Context: Server

Add a listener socket Nginx accept RTMP Connection

server {
Listen 1935;
} Application

Syntax: Application name {...}
Context: Server

Create an rtmp app. The name of an application different from the HTTP location cannot be a pattern.

server {
    listen 1935;
    Application MyApp {
    }
}

Timeout timed out

Syntax: Timeout value
Context: RTMP, server

The socket timed out. This value is primarily used for writing. Most of the time the RTMP module is not expected to have any activity on all sockets except the release socket. If you want to break the socket get a quick disconnect using an active tool such as keepalive or rtmp flat. The default is 1 minutes.

Timeout 60s;

Ping

Syntax: Ping value
Context: rtmp, server

RTMP ping interval. 0 becomes flat. RTMP flat is the Protocol feature for active connection checking. A special packet is sent to the remote peer and the reply is expected to be within the timeout period specified by the ping_timeout instruction.

If the ping reply is not received within this time, then close the connection. The default value for Ping an is 1 minutes. The default ping timeout is 30 seconds.

Ping 3m;
Ping_timeout 30s;
Ping_timeout

Ping_timeout

Syntax: Ping_timeout value
Context: rtmp, server

See the description of the ping above

Max_streams single-class data Max limit

Syntax: Max_streams value
Context: rtmp, server

Sets the maximum number of rtmp streams. The data stream is reused as a single data stream. The default value for sending commands, audio, video etc for different channels is 32, which is usually determined for many situations.

Max_streams 32;

Ack_window

Syntax: Ack_window value
Context: rtmp, server

Sets the size of the rtmp confirmation window. The number of times that the peer should send a confirmation packet to the remote side after the bytes it received. The default value is 5000000.

Ack_window 5000000;

chunk_size data block size

Syntax: Chunk_size value
Context: rtmp, server

The maximum block size is the maximum flow complex number. The default value is 4096 the higher the value, the lower the CPU overhead. This value cannot be less than 128.

Chunk_size 4096; max_queue Maximum number of queues

Syntax: Max_queue value
Context: rtmp, server

According to the above grammar habits is so, the official flat did not give the document, should be set the maximum number of connections parameters, specifically want to know what this is to do see the source code

Max_message

Syntax: Max_queue value
Context: rtmp, server

Enter the maximum size of the data message. All input data sources (blocks, and further) are divided into messages. Part of the information is saved in memory while waiting for it to complete. In theory the incoming message can be very large and can be a problem for the stability of the server. The default value is 1M enough in many cases.

Max_message 1M;

Buflen Buffer

Syntax: Buflen time
Context: rtmp, server

Sets the default buffer length. Typically the client sends the RTMP Set_buflen command before playing and resets the setting. The default value is 1000 milliseconds.

Buflen 5S; Out_queue

There are currently no documents Out_cork

No documents currently available

Access Control Allow

Syntax: Allow [Play|publish] Address|subnet|all
Context: rtmp, Server, application

Allows to publish/play from the specified address or all addresses. The order check that the Allow/Deny directives appear.

Allow publish 127.0.0.1;
Deny publish all;
Allow play 192.168.0.0/24;
Deny play all;



Deny

Syntax: Deny [Play|publish] Address|subnet|all
Context: rtmp, Server, application

See Allow note

Exec Exec_push


Syntax: Exec_push command arg*
Context: rtmp, Server, application

Specifies that each stream will be advertised to execute an external command with parameters. When the release stops processing ends. A binary full path should be specified as the first parameter. There is no hypothesis that this process should be done. However, this function is very useful for convective conversion of ffmpeg.

FFmpeg should be connected to Nginx, rtmp as the client and output conversion stream back to Nginx, rtmp as the issuer. The form is Var/var/{var} in the replaceable command line using

Name−streamname name−streamnameapp-application Name

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.