meetecho / janus-gateway

Janus WebRTC Server
https://janus.conf.meetecho.com
GNU General Public License v3.0
8.17k stars 2.47k forks source link

everything works ok, when I use rtp forward to rtmp , expect that I can't see the video published to the the server #1355

Closed yunnysunny closed 6 years ago

yunnysunny commented 6 years ago

The sdp file saved on /opt/test.sdp :

v=0
o=- 0 0 IN IP4 127.0.0.1
s=RTP Video
c=IN IP4 127.0.0.1
t=0 0
a=tool:libavformat 56.15.102
m=audio 10030 RTP/AVP 111
a=rtpmap:111 OPUS/48000/2
m=video 10035 RTP/AVP 100
a=rtpmap:100 VP8/90000
a=fmtp:100 packetization-mode=1

On the frontend, I use websocket to communicate with the janus, the rtp forward message I send as follows:

{"janus":"message","session_id":4318714695505491,"handle_id":123696543425509,"body":{"request":"rtp_forward","room":1234,"audio_port":10030,"video_port":10035,"host":"127.0.0.1","secret":"adminpwd","publisher_id":8551330095625371},"transaction":"z2Xuifm"}

And it run success, as the janus give a response :

{
   "janus": "success",
   "session_id": 4318714695505491,
   "transaction": "z2Xuifm",
   "sender": 123696543425509,
   "plugindata": {
      "plugin": "janus.plugin.videoroom",
      "data": {
         "publisher_id": 8551330095625371,
         "rtp_stream": {
            "audio_stream_id": 2953663846,
            "audio": 10030,
            "video_stream_id": 664803495,
            "video": 10035,
            "host": "127.0.0.1"
         },
         "room": 1234,
         "videoroom": "rtp_forward"
      }
   }
}

But when I run the ffmpeg command on the janus server, it will stuck for several minutes, only output such info:

# ffmpeg -analyzeduration 300M -probesize 300M -protocol_whitelist file,udp,rtp  -i /opt/test.sdp  -c:v copy -c:a aac -ar 16k -ac 1 -preset ultrafast -tune zerolatency  -f flv  rtmp://myhost/mypath/mystream-id
ffmpeg version 4.0.2-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100

After then, it will output such info,

[sdp @ 0x59c9d80] Could not find codec parameters for stream 1 (Video: vp8, yuv420p): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, sdp, from '/opt/test.sdp':
  Metadata:
    title           : RTP Video
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp
    Stream #0:1: Video: vp8, yuv420p, 90k tbr, 90k tbn, 90k tbc
Codec AVOption preset (Configuration preset) specified for output file #0 (rtmp://59.110.165.206/17live/5b926f0f7faa853c248a5316) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Codec AVOption tune (Tune the encoding to a specific scenario) specified for output file #0 (rtmp://59.110.165.206/17live/5b926f0f7faa853c248a5316) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
  Stream #0:0 -> #0:0 (opus (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, flv, to 'rtmp://59.110.165.206/17live/5b926f0f7faa853c248a5316':
  Metadata:
    title           : RTP Video
    encoder         : Lavf58.12.100
    Stream #0:0: Audio: aac (LC) ([10][0][0][0] / 0x000A), 16000 Hz, mono, fltp, 69 kb/s
    Metadata:
      encoder         : Lavc58.18.100 aac
[sdp @ 0x59c9d80] max delay reached. need to consume packetd=42.7x    
[sdp @ 0x59c9d80] RTP: missed 191 packets
[flv @ 0x5a4a0c0] Failed to update header with correct duration.1x    
[flv @ 0x5a4a0c0] Failed to update header with correct filesize.
size=    4023kB time=00:07:46.28 bitrate=  70.7kbits/s speed=2.81x    

I play the url rtmp://myhost/mypath/mystream-id with the player VLC, it just get nothing. But when I push the url with OBS, the url will be played OK on VLC. I think something has been set in incorrect way, it annoy me in several day, and I can not find the problem.

By the way when I press ctrl+c, it will print

video:0kB audio:3902kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.081117%
[aac @ 0x59cf840] Qavg: 653.844

I don't whether it is helpful, so I also paste it.

lminiero commented 6 years ago

Not a bug, question for the group. Closing.

yunnysunny commented 6 years ago

Have sent a request for adding the group.

yunnysunny commented 6 years ago

I have submitted a post on google group, this is the link