ant-media / Ant-Media-Server

Ant Media Server is a live streaming engine software that provides adaptive, ultra low latency streaming by using WebRTC technology with ~0.5 seconds latency. Ant Media Server is auto-scalable and it can run on-premise or on-cloud.
https://antmedia.io
Other
4.27k stars 628 forks source link

[Enterprise] Connect to Ip Camera but show "Stream will start playing automatically when it is live" #3580

Closed ChangYinShung closed 3 years ago

ChangYinShung commented 3 years ago

Short description

hi , I'm sure that my rtsp link is correct (use vlc player , or ipcamlive). Rtsp link is rtsp://{user}:{password}@{ip}:502 , i modify default port In ant media server : I add a stream source and url is rtsp://{user}:{password}@{ip}:502, but it keep show a message "Stream will start playing automatically when it is live", in the same time , vlc player is play well

Environment

Steps to reproduce

  1. click WebRTCAppEE
  2. add a stream source with a link rtsp://{user}:{password}@{ip}:502
  3. Stream will start playing automatically when it is live

Expected behavior

my ip cam should display.

Actual behavior

image

the rtsp is same( rtsp://{user}:{password}@{ip}:502) but ant media server can't be show image

Logs

2021-08-30 09:14:39,764 [vert.x-eventloop-thread-6] WARN i.a.s.StreamFetcherManager - Mux adaptor is not initialized for stream fetcher with stream id: 643572216023903739854452 It's likely that stream fetching is not started yet 2021-08-30 09:14:39,765 [vert.x-eventloop-thread-6] WARN i.a.s.StreamFetcherManager - Mux adaptor is not initialized for stream fetcher with stream id: 859617589099445460592335 It's likely that stream fetching is not started yet 2021-08-29 13:58:49,946 [vert.x-eventloop-thread-3] WARN i.a.enterprise.webrtc.WebRTCClient - It's still not streaming so stop the webrtc client for stream: 618023651192306098427543 and client:968951610 2021-08-29 13:58:52,907 [vert.x-eventloop-thread-5] WARN i.a.enterprise.webrtc.WebRTCClient - It's still not streaming so stop the webrtc client for stream: 618023651192306098427543 and client:7386856 2021-08-29 13:58:58,947 [vert.x-eventloop-thread-7] WARN i.a.enterprise.webrtc.WebRTCClient - It's still not streaming so stop the webrtc client for stream: 618023651192306098427543 and client:1237930823 [vert.x-eventloop-thread-1] WARN i.a.enterprise.webrtc.WebRTCClient - It's still not streaming so stop the webrtc client for stream: 618023651192306098427543 and client:609833217

mekya commented 3 years ago

Hi @ChangYinShung ,

Thank you for the issue. Do you change the way to pull the RTSP pull stream type to udp and try again?

Add the following property to the application settings webapps/{YOUR_APP_THAT_YOU_USE}/WEB-INF/red5-web.properties

settings.rtspPullTransportType=udp

Then restart the service on the terminal

sudo service antmedia restart
ChangYinShung commented 3 years ago

Hi @ChangYinShung ,

Thank you for the issue. Do you change the way to pull the RTSP pull stream type to udp and try again?

Add the following property to the application settings webapps/{YOUR_APP_THAT_YOU_USE}/WEB-INF/red5-web.properties

settings.rtspPullTransportType=udp

@mekya i add this into /usr/local/antmedia/webapps/WebRTCAppEE/WEB-INF/red5-web.properties and restart antmedia

image

  1. I'm use hikvision 's camera , it seem that don't have config to allow me set udp/tcp for rtsp
  2. You think that my server udp connection has problem ?
  3. here is my log
    2021-08-31 09:52:10,712 [Thread-342] ERROR i.a.streamsource.StreamFetcher - MuxAdaptor.Prepare for 618023651192306098427543 returned false
    2021-08-31 09:52:11,064 [Thread-343] ERROR i.a.streamsource.StreamFetcher - MuxAdaptor.Prepare for 769100715525831463369704 returned false
    2021-08-31 09:52:11,494 [Thread-344] ERROR i.a.streamsource.StreamFetcher - MuxAdaptor.Prepare for 209232806380731693642245 returned false
    2021-08-31 09:52:14,146 [vert.x-eventloop-thread-7] WARN  i.a.s.StreamFetcherManager - Mux adaptor is not initialized for stream fetcher with stream id: 209232806380731693642245 It's likely that stream fetching is not started yet
    2021-08-31 09:52:14,146 [vert.x-eventloop-thread-7] WARN  i.a.s.StreamFetcherManager - Mux adaptor is not initialized for stream fetcher with stream id: 618023651192306098427543 It's likely that stream fetching is not started yet
    2021-08-31 09:52:14,146 [vert.x-eventloop-thread-7] WARN  i.a.s.StreamFetcherManager - Mux adaptor is not initialized for stream fetcher with stream id: 643572216023903739854452 It's likely that stream fetching is not started yet
    2021-08-31 09:52:14,146 [vert.x-eventloop-thread-7] WARN  i.a.s.StreamFetcherManager - Mux adaptor is not initialized for stream fetcher with stream id: 769100715525831463369704 It's likely that stream fetching is not started yet
    2021-08-31 09:52:14,146 [vert.x-eventloop-thread-7] WARN  i.a.s.StreamFetcherManager - Mux adaptor is not initialized for stream fetcher with stream id: 859617589099445460592335 It's likely that stream fetching is not started yet
    2021-08-31 09:52:14,146 [vert.x-eventloop-thread-7] WARN  i.a.s.StreamFetcherManager - Mux adaptor is not initialized for stream fetcher with stream id: 895955585650087874013777 It's likely that stream fetching is not started yet
    2021-08-31 09:52:14,387 [Thread-345] ERROR i.a.streamsource.StreamFetcher - MuxAdaptor.Prepare for 859617589099445460592335 returned false
mekya commented 3 years ago

Hi @ChangYinShung ,

There may be some connection problem.

What is the output on the terminal when you run the following command in the server?

ffmpeg -i {RTSP_URL}
ChangYinShung commented 3 years ago

Hi, @mekya , i do follow command :

sudo apt  install ffmpeg
ffmpeg -i {RTSP_URL}

Then i get those log

ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --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-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
[rtsp @ 0x55acb4ded600] UDP timeout, retrying with TCP
[rtsp @ 0x55acb4ded600] method PAUSE failed: 551 Option not supported
[rtsp @ 0x55acb4ded600] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, rtsp, from '{RTSP_URL}':
  Metadata:
    title           : Media Presentation
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264, none, 90k tbr, 90k tbn, 180k tbc
At least one output file must be specified

1.the problem is my server connect camera 's udp connection timeout ? 2.do you have mail ? i can send you all of camera with user/password for more detail?

ChangYinShung commented 3 years ago

1.I found out that my camera(HIKVISION cameras) rtsp can only be use by tcp.(https://github.com/datarhei/restreamer/issues/3)

2.so should i change any setting on ant media server?

3.here is my log by this command ffmpeg -rtsp_transport tcp -i {RTSP_URL}

ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --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-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, rtsp, from '{RTSP_URL}':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.240000, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 2560x1440, 25 fps, 25 tbr, 90k tbn, 50 tbc
mekya commented 3 years ago

Hi @ChangYinShung ,

If you just change the udp to tcp in the below message, it will use tcp to get the stream.

Then just try to play with HLS, you can give playOrder=hls in the embedded player to play it with HLS.

https://github.com/ant-media/Ant-Media-Server/wiki/Embedded-Web-Player

If it plays, I think you may change your HikVision IP camera H264 profile to baseline from main. Alternatively, you can add one adaptive bitrate on the server side.

Hi @ChangYinShung ,

Thank you for the issue. Do you change the way to pull the RTSP pull stream type to udp and try again?

Add the following property to the application settings webapps/{YOUR_APP_THAT_YOU_USE}/WEB-INF/red5-web.properties

settings.rtspPullTransportType=udp

Then restart the service on the terminal

sudo service antmedia restart
ChangYinShung commented 3 years ago

@mekya playOrder=hls was work , thanks. i will close this issue.

mekya commented 3 years ago

Hi @ChangYinShung ,

Thank you for letting me now.

I think IP camera feed may not be compatible with WebRTC playback. This may be the cause why you're having this problem.