pingostack / pingostack.github.io

0 stars 3 forks source link

转推 - PingOS #18

Open im-pingo opened 4 years ago

im-pingo commented 4 years ago

https://pingos.io/docs/zh/config-dir-push

open source software for streaming media

vnfreezone commented 4 years ago

Hello, Please help because most of the docs in Chinese. I can't find a way to push or I did make mistake on command.

For example:

On rtmp { server { application live {

push rtmp://sg.pscp.tv:80 app=x name=123456;

On simply Nginx RTMP I put like below and it work but not with PingOS

push rtmp://sg.pscp.tv:80/x/123456

im-pingo commented 4 years ago

@vnfreezone Hello, Please help because most of the docs in Chinese. I can't find a way to push or I did make mistake on command.

For example:

  • Server : rtmp://sg.pscp.tv:80/x
  • Streamkey: 123456

On rtmp { server { application live {

push rtmp://sg.pscp.tv:80 app=x name=123456;

On simply Nginx RTMP I put like below and it work but not with PingOS

push rtmp://sg.pscp.tv:80/x/123456

Please post the error log of your server. If you want to use the domain name in the configuration file, you need to add the DNS server address.

events {
    use epoll;
    worker_connections  4096;
    multi_listen unix:/tmp/http 80;
    multi_listen unix:/tmp/rtmp 1935;

    dynamic_refresh_interval 5s;
    dynamic_domain_buckets   1001;
    resolver 8.8.8.8  valid=1m; # DNS Server
    resolver_timeout 30s;
}
vnfreezone commented 4 years ago

Error log

2020/05/22 07:38:44 [notice] 3634#0: signal process started 2020/05/22 07:38:44 [notice] 1244#0: using the "epoll" event method 2020/05/22 07:38:44 [notice] 1244#0: start worker processes 2020/05/22 07:38:44 [notice] 1244#0: start worker process 3635 2020/05/22 07:38:44 [notice] 1244#0: start worker process 3636 2020/05/22 07:38:44 [notice] 1244#0: start worker process 3637 2020/05/22 07:38:44 [notice] 1244#0: start worker process 3638 2020/05/22 07:38:44 [notice] 1244#0: start cache manager process 3639 2020/05/22 07:38:44 [notice] 1244#0: signal 17 (SIGCHLD) received from 1307 2020/05/22 07:38:44 [notice] 1244#0: cache manager process 1307 exited with code 0 2020/05/22 07:38:44 [notice] 1244#0: signal 29 (SIGIO) received 2020/05/22 07:38:44 [notice] 1244#0: signal 17 (SIGCHLD) received from 1305 2020/05/22 07:38:44 [notice] 1244#0: worker process 1305 exited with code 0 2020/05/22 07:38:44 [notice] 1244#0: signal 29 (SIGIO) received 2020/05/22 07:38:44 [notice] 1244#0: signal 17 (SIGCHLD) received from 1304 2020/05/22 07:38:44 [notice] 1244#0: worker process 1304 exited with code 0 2020/05/22 07:38:44 [notice] 1244#0: signal 29 (SIGIO) received 2020/05/22 07:38:44 [notice] 1244#0: signal 17 (SIGCHLD) received from 1306 2020/05/22 07:38:44 [notice] 1244#0: worker process 1306 exited with code 0 2020/05/22 07:38:44 [notice] 1244#0: signal 29 (SIGIO) received 2020/05/22 07:45:37 [notice] 3718#0: signal process started 2020/05/22 07:45:37 [notice] 1244#0: signal 1 (SIGHUP) received from 3718, reconfiguring 2020/05/22 07:45:37 [notice] 1244#0: reconfiguring 2020/05/22 07:45:37 [notice] 1244#0: using the "epoll" event method 2020/05/22 07:45:37 [notice] 1244#0: start worker processes 2020/05/22 07:45:37 [notice] 1244#0: start worker process 3719 2020/05/22 07:45:37 [notice] 1244#0: start worker process 3720 2020/05/22 07:45:37 [notice] 1244#0: start worker process 3721 2020/05/22 07:45:37 [notice] 1244#0: start worker process 3722 2020/05/22 07:45:37 [notice] 1244#0: start cache manager process 3723 2020/05/22 07:45:38 [notice] 3636#0: gracefully shutting down 2020/05/22 07:45:38 [notice] 3635#0: gracefully shutting down 2020/05/22 07:45:38 [notice] 3635#0: exiting 2020/05/22 07:45:38 [notice] 3636#0: exiting 2020/05/22 07:45:38 [notice] 3638#0: gracefully shutting down 2020/05/22 07:45:38 [notice] 3638#0: exiting 2020/05/22 07:45:38 [notice] 3635#0: exit 2020/05/22 07:45:38 [notice] 3638#0: exit 2020/05/22 07:45:38 [notice] 3637#0: gracefully shutting down 2020/05/22 07:45:38 [notice] 3639#0: exiting 2020/05/22 07:45:38 [notice] 3637#0: exiting 2020/05/22 07:45:38 [notice] 3637#0: exit 2020/05/22 07:45:38 [notice] 1244#0: signal 17 (SIGCHLD) received from 3638 2020/05/22 07:45:38 [notice] 1244#0: worker process 3635 exited with code 0 2020/05/22 07:45:38 [notice] 1244#0: worker process 3638 exited with code 0 2020/05/22 07:45:38 [notice] 1244#0: cache manager process 3639 exited with code 0 2020/05/22 07:45:38 [notice] 1244#0: signal 29 (SIGIO) received 2020/05/22 07:45:38 [notice] 3636#0: exit 2020/05/22 07:45:38 [notice] 1244#0: signal 17 (SIGCHLD) received from 3637 2020/05/22 07:45:38 [notice] 1244#0: worker process 3636 exited with code 0 2020/05/22 07:45:38 [notice] 1244#0: worker process 3637 exited with code 0 2020/05/22 07:45:38 [notice] 1244#0: signal 29 (SIGIO) received

My nginx.conf


user  root;
daemon on;
master_process on;
worker_processes  4;
#worker_rlimit 4g;

error_log logs/error.log;

error_log logs/error.log notice;

error_log logs/error.log info;

worker_rlimit_nofile 102400; worker_rlimit_core 2G; working_directory /tmp;

pid logs/nginx.pid;

events { use epoll; worker_connections 4096; multi_listen unix:/tmp/http 80; multi_listen unix:/tmp/rtmp 1935;

dynamic_refresh_interval 5s;
dynamic_domain_buckets   1001;
resolver 1.1.1.1 valid=1m;
resolver_timeout 30s;

}

stream_zone buckets=1024 streams=4096;

dynamic_conf conf/nginx_dynamic.conf 10;

dynamic_log logs/dynamic.log info;

rtmp { log_format log_bandwidth '{"app":"$app","name":"$name","bitrate":$bitrate,"args":"$args","timestamp":$ntp,"ts":"$time_local","type":"$command","remote_addr":"$remote_addr","domain":"$domain"}'; access_log logs/bandwidth.log log_bandwidth trunc=60s;

server {
    listen 1935;
    serverid 000;
    out_queue 2048;
    server_name krds.xyz;
    rtmp_auto_pull on;
    rtmp_auto_pull_port unix:/tmp/rtmp;

    application push {
        live on;
        push rtmp://127.0.0.1/live app=live;
   }

    application live {

live_record off;

live_record_path /data/record;

recorder r1{

record off;

record_path /data/record;

}

push rtmp://sg.pscp.tv:80 app=x name=123456;
        live on;
        hls on;
        hls_path /tmp/hls;
        hls_fragment 2000ms;

hls_max_fragment 10000ms;

        hls_playlist_length 4000ms;
        hls_type live;

        hls2 on;
        mpegts_cache_time 20s;

        hls2_fragment 2000ms;
        hls2_max_fragment 3000ms;
        hls2_playlist_length 6000ms;

        wait_key on;
        wait_video on;
        cache_time 1s;
        send_all on;
        low_latency off;
        fix_timestamp 2s;

h265 codecid, default 12

        hevc_codecid  12;
    }
}

}

http { include mime.types; default_type application/octet-stream;

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                  '$status $body_bytes_sent "$http_referer" '
                  '"$http_user_agent" "$http_X-Forwarded-For" "$http_X-Real-IP" "$host"';

access_log  logs/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#reset_server_name www.test1.com www.test2.com;
#gzip  on;

upstream hlsm {

hash $remote_addr consistent;

    hash $arg_session consistent;
    # 这里需要注意,你要开几个进程,就要按这个规则写几条记录
    server unix:/tmp/http.0;
    server unix:/tmp/http.1;
    server unix:/tmp/http.2;
    server unix:/tmp/http.3;
}

server {
    listen 80;

listen 443 ssl;

ssl_certificate /usr/local/pingos/cert/full_chain.pem;

ssl_certificate_key /usr/local/pingos/cert/privkey.pem;

    location /rtmp_stat {
        rtmp_stat all;
        rtmp_stat_stylesheet /stat.xsl;
    }

    location /xstat {
        rtmp_stat all;
    }

    location /sys_stat {
        sys_stat;
    }
    location ~ .mp4$ {
        root html;
        #mp4;
    }

    location /control {
        rtmp_control all;
    }
     location /flv {
         flv_live 1935 app=live;
         add_header 'Access-Control-Allow-Origin' '*';
         add_header "Access-Control-Allow-Credentials" "true";
         add_header "Access-Control-Allow-Methods" "*";
         add_header "Access-Control-Allow-Headers" "Content-Type,Access-Token";
         add_header "Access-Control-Expose-Headers" "*";
     }
     location /ts {
         ts_live 1935 app=live;
         expires -1;
         add_header 'Access-Control-Allow-Origin' '*';
         add_header "Access-Control-Allow-Credentials" "true";
         add_header "Access-Control-Allow-Methods" "*";
         add_header "Access-Control-Allow-Headers" "Content-Type,Access-Token";
         add_header "Access-Control-Expose-Headers" "*";
     }
     location /hls {
        # Serve HLS fragments
         types {
             application/vnd.apple.mpegurl m3u8;
             video/mp2t ts;
         }
         root /tmp;
         expires -1;
         add_header Cache-Control no-cache;
         add_header 'Access-Control-Allow-Origin' '*';
         add_header "Access-Control-Allow-Credentials" "true";
         add_header "Access-Control-Allow-Methods" "*";
         add_header "Access-Control-Allow-Headers" "Content-Type,Access-Token";
         add_header "Access-Control-Expose-Headers" "*";
     }

    location /hlsm {
         hls2_live 1935 app=live;
         add_header 'Access-Control-Allow-Origin' '*';
         add_header Cache-Control no-cache;
         add_header "Access-Control-Allow-Credentials" "true";
         add_header "Access-Control-Allow-Methods" "*";
         add_header "Access-Control-Allow-Headers" "Content-Type,Access-Token";
         add_header "Access-Control-Expose-Headers" "*";
     }

     location /hls2 {
         proxy_buffering on;
         proxy_buffer_size 4k; 
         proxy_buffers 8 1M;
         proxy_busy_buffers_size 2M;
         proxy_max_temp_file_size 0;
         set $hls_args location=/hls2&scheme=$scheme;

if ($args) {

set $hls_args $args&location=/hls2&scheme=$scheme;

}

         proxy_set_header Host $host:$server_port;
         rewrite ^/(.*)/(.*)\.(.*)$ /hlsm/$2.$3?$hls_args break;
         proxy_pass http://hlsm;
     }

     location / {
         chunked_transfer_encoding on;
         root html/;
     }
}

}

fruitsw commented 4 years ago

您好,请问如何在 转推 中支持RTMPS

vnfreezone commented 4 years ago

Stunnel for RTMPS

On Fri, Jul 10, 2020, 5:16 PM Badcoding notifications@github.com wrote:

您好,请问如何在 转推 中支持RTMPS

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pingostack/pingostack.github.io/issues/18#issuecomment-656600208, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACG7QEPTSSOUDHKLJBXDVM3R23S57ANCNFSM4MLWJQDQ .