FFmpeg cannot play rtmp stream

Showing 1-1 of 1 messages
FFmpeg cannot play rtmp stream Patrik Janoušek 8/7/17 7:14 AM

Hello guys,
I am trying to set nginx rtmp stream server, but sometimes ffmpeg will stuck at the end of following output:

root@s02:/# ffmpeg -i rtmp://127.0.0.1:1935/show/IzzP7kmqzlzhP23DK49iCmD0bU2YEuxKBKesDIYJ3IxI4R6rmB -vcodec libx264 -vprofile high -preset ultrafast -x264opts keyint=40 -vf scale=480x360 -minrate 600k -maxrate 800k -acodec aac -strict -2 -f flv rtmp://127.0.0.1:1935/hls/hellena_low -vcodec libx264 -vprofile high -preset ultrafast -x264opts keyint=40 -vf scale=640x480 -minrate 900k -maxrate 1200k -acodec aac -strict -2 -f flv rtmp://127.0.0.1:1935/hls/hellena_mid -c copy -f flv rtmp://127.0.0.1:1935/hls/hellena_src -loglevel trace
ffmpeg version 3.2.5-1~bpo8+1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/usr --extra-version='1~bpo8+1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --disable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument 'rtmp://127.0.0.1:1935/show/IzzP7kmqzlzhP23DK49iCmD0bU2YEuxKBKesDIYJ3IxI4R6rmB'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'libx264'.
Reading option '-vprofile' ... matched as AVOption 'vprofile' with argument 'high'.
Reading option '-preset' ... matched as AVOption 'preset' with argument 'ultrafast'.
Reading option '-x264opts' ... matched as AVOption 'x264opts' with argument 'keyint=40'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'scale=480x360'.
Reading option '-minrate' ... matched as AVOption 'minrate' with argument '600k'.
Reading option '-maxrate' ... matched as AVOption 'maxrate' with argument '800k'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'aac'.
Reading option '-strict' ...Routing option strict to both codec and muxer layer
 matched as AVOption 'strict' with argument '-2'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'flv'.
Reading option 'rtmp://127.0.0.1:1935/hls/hellena_low' ... matched as output url.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'libx264'.
Reading option '-vprofile' ... matched as AVOption 'vprofile' with argument 'high'.
Reading option '-preset' ... matched as AVOption 'preset' with argument 'ultrafast'.
Reading option '-x264opts' ... matched as AVOption 'x264opts' with argument 'keyint=40'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'scale=640x480'.
Reading option '-minrate' ... matched as AVOption 'minrate' with argument '900k'.
Reading option '-maxrate' ... matched as AVOption 'maxrate' with argument '1200k'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'aac'.
Reading option '-strict' ...Routing option strict to both codec and muxer layer
 matched as AVOption 'strict' with argument '-2'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'flv'.
Reading option 'rtmp://127.0.0.1:1935/hls/hellena_mid' ... matched as output url.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'flv'.
Reading option 'rtmp://127.0.0.1:1935/hls/hellena_src' ... matched as output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'trace'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument trace.
Successfully parsed a group of options.
Successfully parsed a group of options.
[rtmp @ 0x5600e698b760] No default whitelist set
[tcp @ 0x5600e698bc80] No default whitelist set
[rtmp @ 0x5600e698b760] Handshaking...
[rtmp @ 0x5600e698b760] Type answer 3
[rtmp @ 0x5600e698b760] Server version 13.14.10.13
[rtmp @ 0x5600e698b760] Proto = rtmp, path = /show/IzzP7kmqzlzhP23DK49iCmD0bU2YEuxKBKesDIYJ3IxI4R6rmB, app = show, fname = IzzP7kmqzlzhP23DK49iCmD0bU2YEuxKBKesDIYJ3IxI4R6rmB
[rtmp @ 0x5600e698b760] Server bandwidth = 5000000
[rtmp @ 0x5600e698b760] Client bandwidth = 5000000
[rtmp @ 0x5600e698b760] New incoming chunk size = 4096
[rtmp @ 0x5600e698b760] Creating stream...
[rtmp @ 0x5600e698b760] Sending play command for 'IzzP7kmqzlzhP23DK49iCmD0bU2YEuxKBKesDIYJ3IxI4R6rmB'

When I try to run ffmpeg command immediately after start of stream, everything works well. But when I start RTMP stream and wait about one minute, ffmpeg get stuck at the line "Sending play command....".

Here is my configuration of app show:

application show {
            live on;

            on_publish http://mywebsite.cz/api;

            exec /usr/local/nginx/scripts/stream_init.sh $app $name;
            exec_kill_signal term;
        }

In VLC I have no problems with playing RTMP stream, everything works well.

I use nginx 1.11.15 and nginx-rtmp-module in version 1.1.11.

Thank you for your help.