arut / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
13.46k stars 3.51k forks source link

help my nginx show ( unknown directive "ffmpeg" ) #1236

Open MasAries opened 6 years ago

MasAries commented 6 years ago

this is my nginx.conf ` user www-data; worker_processes auto; events { worker_connections 1024; }

RTMP configuration

rtmp { server { listen 1935; # Listen on standard RTMP port chunk_size 4000;

    application show {
        live on;
        # Turn on HLS
        hls on;
        hls_path /mnt/hls/;
        hls_fragment 3;
        hls_playlist_length 60;
        # disable consuming the stream from nginx as rtmp 
    # publish only from localhost
        allow publish all;
    allow play all;
    # ffmpeg
   exec_static  ffmpeg -re -i youtube-dl --get-url https://www.youtube.com/watch?v=cUSFptIfiIk -c:v copy -ar 44100 -ab 128k -ac 2 -strict -2 -f flv rtmp://127.0.0.1/hls/stream1;
    }
}

}

http {

aio on;

directio 512;
expires -1;
    sendfile off;
    charset utf-8;
    include mime.types;
    default_type application/octet-stream;
    server_tokens off;
    keepalive_timeout 20;
    tcp_nopush on;
    tcp_nodelay off;
    server_name_in_redirect off;
    types_hash_max_size 2048;
    gzip on;
    gzip_http_version 1.0;
    gzip_comp_level 5;
    gzip_min_length 512;
    gzip_buffers 4 8k;
    gzip_proxied any;
    gzip_types
    text/css
    text/plain
    text/x-component
    application/javascript
    application/json
    application/xml
    application/xhtml+xml
    application/x-font-ttf
    application/x-font-opentype
    application/vnd.ms-fontobject
    image/svg+xml
    image/x-icon;
    gzip_disable "msie6";
    gzip_vary on;

server {
    listen 8080;

    location / {
        # Disable cache
        add_header 'Cache-Control' 'no-cache';

        # CORS setup
        add_header 'Access-Control-Allow-Origin' '*' always;
        add_header 'Access-Control-Expose-Headers' 'Content-Length';

        # allow CORS preflight requests
        if ($request_method = 'OPTIONS') {
            add_header 'Access-Control-Allow-Origin' '*';
            add_header 'Access-Control-Max-Age' 1728000;
            add_header 'Content-Type' 'text/plain charset=UTF-8';
            add_header 'Content-Length' 0;
            return 204;
        }

        types {
            application/dash+xml mpd;
            application/vnd.apple.mpegurl m3u8;
            video/mp2t ts;
        }

        root /mnt/;
    }
}

    server {

listen 80;

xx.xxx.xxx.xxx"

server_name_in_redirect off; charset utf-8; access_log /usr/local/nginx/access.log; error_log /usr/local/nginx/error.log; root /usr/local/nginx/html; index index.php index.html; location / { try_files $uri $uri/ =404; server_name_in_redirect off; } location ~ .php$ { try_files $uri $uri/ /index.php; fastcgi_split_path_info ^(.+.php)(/.+)$; fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }

}

}

` show failed :) root@server:~# /usr/local/nginx/sbin/nginx -t nginx: [emerg] unknown directive "ffmpeg" in /usr/local/nginx/conf/nginx.conf:26 nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed

help to make that work, what should i do

UKNickyD commented 6 years ago

try using the full path to ffmpeg, you can find this by running

which ffmpeg

mine is /usr/bin/ffmpeg

jblstv commented 4 years ago

try using the full path to ffmpeg, you can find this by running

which ffmpeg

mine is /usr/bin/ffmpeg

using exec ffmpeg should fix it