Can't publish RTMP stream with FFMPEG

Maxi

New Member
Hello everyone,
I am facing a strange problem with WCS.
It is installed on a root server running CentOS 7. The installation was successful. The instructions for troubleshooting (https://forum.flashphoner.com/threads/troubleshooting.10768/) didn't help a lot in this case and only showed that everything was correctly setup.

I try to publish an example video with ffmpeg to WCS. This video should then be played back through WebRTC (which doesn't matter for this problem though). I publish the video through RTMP. The FFMPEG command is the following:
Code:
.\ffmpeg.exe -i ..\..\big_buck_bunny_1080p_h264.mov -c:v libx264 -profile:v baseline -preset medium -tune zerolatency -s 1280x720 -b:v 6000k -r 30 -an -g 15 -f flv rtmp://hostaddress:1935/app/test
"test" would the RTMP-streamName.

This is the output I receive from FFMPEG:

Code:
ffmpeg version N-85750-ga75ef15 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 61.100 / 55. 61.100
  libavcodec     57. 93.100 / 57. 93.100
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 88.100 /  6. 88.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '..\..\big_buck_bunny_1080p_h264.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2008-05-27T18:40:35.000000Z
    com.apple.quicktime.player.movie.audio.gain: 1.000000
    com.apple.quicktime.player.movie.audio.treble: 0.000000
    com.apple.quicktime.player.movie.audio.bass: 0.000000
    com.apple.quicktime.player.movie.audio.balance: 0.000000
    com.apple.quicktime.player.movie.audio.pitchshift: 0.000000
    com.apple.quicktime.player.movie.audio.mute:
    com.apple.quicktime.player.movie.visual.brightness: 0.000000
    com.apple.quicktime.player.movie.visual.color: 1.000000
    com.apple.quicktime.player.movie.visual.tint: 0.000000
    com.apple.quicktime.player.movie.visual.contrast: 1.000000
    com.apple.quicktime.player.version: 7.4.1 (14)
    com.apple.quicktime.version: 7.4.1 (14) 0x7418000 (Mac OS X, 10.5.2, 9C31)
    timecode        : 00:00:00:00
  Duration: 00:09:56.46, start: 0.000000, bitrate: 9725 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 9282 kb/s, 24 fps, 24 tbr, 2400 tbn, 4800 tbc (default)
    Metadata:
      rotate          : 0
      creation_time   : 2008-05-27T18:40:35.000000Z
      handler_name    : Apple Alias Data Handler
      encoder         : H.264
    Side data:
      displaymatrix: rotation of -0.00 degrees
    Stream #0:1(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      rotate          : 0
      creation_time   : 2008-05-27T18:40:35.000000Z
      handler_name    : Apple Alias Data Handler
      timecode        : 00:00:00:00
    Stream #0:2(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 437 kb/s (default)
    Metadata:
      rotate          : 0
      creation_time   : 2008-05-27T18:40:35.000000Z
      handler_name    : Apple Alias Data Handler
Closing connection: NetStream.Failed
rtmp://94.130.228.200:1935/app/test: Unknown error occurred
As seen in the last two lines, no connection can be established.
I am sure that all relevant ports are open, I am also reaching the webpage exposed on port :8888 by WCS.

Strangely, whene I change "rtmp://" with "rtp://", no error is thrown and the video seems to be processed as expected.

What may be the problem in this case that I can't stream the video through RTMP?

Thanks in advance.
 

Max

Administrator
Staff member
1. Make sure you have TCP port 1935 open.
Check if server logs alive
2. tail -f /usr/local/FlashphonerWebCallServer/logs/server_logs/flashphoner.log
If you have errors in logs, please share the error log.

Here is example of working ffmpeg command
Code:
ffmpeg -re -i /tmp/video.avi -preset ultrafast -acodec aac -vcodec h264 -strict -2 -f flv rtmp://192.168.1.5:1935/live/stream1
 

Maxi

New Member
Code:
09:27:04,123 INFO         ServerHandler - RTMP-BOSS-pool-1-thread-1 opened channel: [id: 0x63dc3414, /185.5.197.183:26713 => /172.31.1.100:1935] OPEN
09:27:04,130 INFO                     J - RTMP-pool-2-thread-16 client part 1 validation success
09:27:04,134 INFO                     J - RTMP-pool-2-thread-16 initialized encryption / decryption ciphers
09:27:04,159 INFO                     A - RTMP-pool-2-thread-16 handshake done, rtmpe: false
09:27:04,181 INFO         ServerHandler - RTMP-pool-2-thread-16 command - connect
09:27:04,182 INFO         ServerHandler - RTMP-pool-2-thread-16 connect, client id: 1675375636, application: [name: '' streams: {}]
09:27:04,182 INFO         ServerHandler - RTMP-pool-2-thread-16 [0 COMMAND_AMF0 c3 #0 t0 (0) s143] name: connect, transactionId: 1, object: TransferObject{dataMap={app=live, type=nonprivate, flashVer=FMLE/3.0 (compatible; Lavf58.9.100), tcUrl=rtmp://94.130.228.200:1935/live}typeMap={app=class java.lang.String, tcUrl=class java.lang.String, flashVer=class java.lang.String, type=class java.lang.String}}, args: []
09:27:04,288 INFO                  Peer - Thread-64 Flash client connected true
09:27:04,373 INFO         ServerHandler - RTMP-pool-2-thread-16 command - releaseStream
09:27:04,374 INFO         ServerHandler - RTMP-pool-2-thread-16 received not used message: [1 COMMAND_AMF0 c3 #0 t0 (0) s36] name: releaseStream, transactionId: 2, object: null, args: [stream1]
09:27:04,374 INFO         ServerHandler - RTMP-pool-2-thread-16 command - FCPublish
09:27:04,374 INFO         ServerHandler - RTMP-pool-2-thread-16 received not used message: [1 COMMAND_AMF0 c3 #0 t0 (0) s32] name: FCPublish, transactionId: 3, object: null, args: [stream1]
09:27:04,374 INFO         ServerHandler - RTMP-pool-2-thread-16 command - createStream
09:27:04,374 INFO         ServerHandler - RTMP-pool-2-thread-16 create stream id: 1
09:27:04,460 INFO         ServerHandler - RTMP-pool-2-thread-16 command - publish
09:27:04,460 INFO         ServerHandler - RTMP-pool-2-thread-16 [0 COMMAND_AMF0 c8 #1 t0 (0) s37] name: publish, transactionId: 5, object: null, args: [stream1, live]
09:27:04,460 INFO         ServerHandler - RTMP-pool-2-thread-16 publish, stream name: stream1, type: live
09:27:04,460 INFO                     B - RTMP-pool-2-thread-16 Created ServerStream [name: 'stream1 publisher: null subscribers: {}]
09:27:04,461 ERROR lashStreamingHandler - RTMP-pool-2-thread-16 License error
java.lang.NullPointerException
        at com.flashphoner.server.license.manager.LicenseManager.check(Unknown Source)
        at com.flashphoner.server.client.handler.wcs4.FlashStreamingHandler.onPublish(Unknown Source)
        at com.flashphoner.server.client.handler.DelegateHandler.onPublish(Unknown Source)
        at com.flashphoner.server.rtmfp.client.FlashClient.onPublish(Unknown Source)
        at com.flashphoner.server.J.C.D.G.C(Unknown Source)
        at com.flashphoner.server.J.C.D.G.messageReceived(Unknown Source)
        at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(Unknown Source)
        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(Unknown Source)
        at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(Unknown Source)
        at org.jboss.netty.channel.Channels.fireMessageReceived(Unknown Source)
        at org.jboss.netty.handler.codec.frame.FrameDecoder.unfoldAndFireMessageReceived(Unknown Source)
        at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(Unknown Source)
        at org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(Unknown Source)
        at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(Unknown Source)
        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(Unknown Source)
        at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(Unknown Source)
        at org.jboss.netty.channel.Channels.fireMessageReceived(Unknown Source)
        at org.jboss.netty.channel.Channels.fireMessageReceived(Unknown Source)
        at org.jboss.netty.channel.socket.nio.NioWorker.read(Unknown Source)
        at org.jboss.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(Unknown Source)
        at org.jboss.netty.channel.socket.nio.DeadlockAwareNioWorker.run(Unknown Source)
        at org.jboss.netty.util.ThreadRenamingRunnable.run(Unknown Source)
        at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
09:27:04,484 INFO         ServerHandler - RTMP-pool-2-thread-16 channel closed: [id: 0x63dc3414, /185.5.197.183:26713 :> /172.31.1.100:1935] CLOSED
09:27:04,484 INFO  lashStreamingHandler - RTMP-pool-2-thread-16 Disconnect client: com.flashphoner.server.client.MediaWCSClient@1ed2c793
09:27:04,486 INFO          RTMP-Session - RTMP-pool-2-thread-16 kill session 1675375636
Now I know what the problem was and I fixed it. There were obviously problems with the licensing, I had to re-enter the license key.
Thanks for your help.
 
Top