arut / nginx-rtmp-module

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

Can't push automatically on Debian system #1582

Open guoyanzhang0817 opened 3 years ago

guoyanzhang0817 commented 3 years ago

I am a RTMP beginner. I installed nginx 1.18 and nginx RTMP module according to the tips in this article. But I found that ffplay can't be played. I don't know what's going on? /usr/local/nginx$ sudo vim /usr/local/nginx/conf/nginx.conf

worker_processes  1;
events {
    worker_connections  1024;
}
http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;
    server {
        listen       8080;
        server_name  localhost;
        location / {
            root   html;
            index  index.html index.htm;
        }

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

    location /stat.xsl {
        root /usr/local/src/nginx-rtmp-module/;
    }
    location /control {
        rtmp_control all;
    }   
    location /hls {
        types {
        application/vnd.apple.mpegurl m3u8;
        video/mp2t ts;
        }
        root html;
            expires 60s;
    }
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}
rtmp {
     server {
    listen 1935;
    chunk_size 4000;    
    application mytv {
            live on;
        record_path /usr/local/nginx/html/av;
        allow publish 127.0.0.1;
        deny publish all;
    }
    application hls {
        live on;
        hls on;
            hls_path /usr/local/nginx/html/hls;
            hls_fragment 5s;
    }
    }
}

then,I copy a 'test.h264' to /usr/local/nginx/html/hls/, next, I used ffplay to play, but there is no any video.

rtmp-master$ ffplay -vf scale=720:480 rtmp://127.0.0.1:1935/hls/test.h264 ffplay version 4.1.6-1~deb10u1 Copyright (c) 2003-2020 the FFmpeg developers built with gcc 8 (Debian 8.3.0-6) configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared libavutil 56. 22.100 / 56. 22.100 libavcodec 58. 35.100 / 58. 35.100 libavformat 58. 20.100 / 58. 20.100 libavdevice 58. 5.100 / 58. 5.100 libavfilter 7. 40.101 / 7. 40.101 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 3.100 / 5. 3.100 libswresample 3. 3.100 / 3. 3.100 libpostproc 55. 3.100 / 55. 3.100 nan : 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0

guoyanzhang0817 commented 3 years ago

In addition, I would like to ask a question about RTMP workflow. Play RTMP format video stream: video source, encapsulate data into RTMP format, and then send it to nginx (RTMP server)? Then, does nginx actively push to the player, or must the player actively request from nginx? If the video source does not send data, can nginx push the video data to the player?

genofire commented 3 years ago

you do not push any video to the rtmp application ....

e.g.

ffmpeg -re -i test.h264 -f flv rtmp://127.0.0.1:1935/hls/test

during this stream reached the rtmp-nginx server it will create /usr/local/nginx/html/hls/test.m3u8 and the fragments as files.