AirenSoft / OvenMediaEngine

OvenMediaEngine (OME) is a Sub-Second Latency Live Streaming Server with Large-Scale and High-Definition. #WebRTC #LLHLS
https://airensoft.com/ome.html
GNU Affero General Public License v3.0
2.59k stars 1.06k forks source link

[NEED HELP] RTSP to WebRTC (Cannot find stream) #274

Closed KVAnton-WEB closed 3 years ago

KVAnton-WEB commented 3 years ago

Hi, I need help with config.

Now, my playground on the local network: I have rtsp: rtsp://192.168.1.40:8554/unicast I have PC on Ubuntu 20.04 and Chromium: 192.168.1.34 I have server on Ubuntu Server 20.04: 192.168.1.41

I have this error in the browser (for Request URL: ws://192.168.1.41:3333/):

{"command":"request_offer"} 
{"code":404,"error":"Cannot create offer"}

DevTools Console log: -1612672780015.log

main.js:233 error occured : {code: 501, message: "Connection with low-latency(OME) server failed.", reason: "WebSocket connection failed.", error: "Cannot create offer"

Run docker on server: sudo docker run -d -p 1935:1935 -p 4000-4005:4000-4005/udp -p 3333:3333 -p 8080:8080 -p 9000:9000 -p 10000-10010:10000-10010/udp airensoft/ovenmediaengine:latest

Inside docker container - I can play rtsp by ffmpeg: ffmpeg -i rtsp://192.168.1.40:8554/unicast

Stream #0:0: Video: h264 (High), yuv420p(progressive), 640x480, 25.08 tbr, 90k tbn, 180k tbc
At least one output file must be specified

My /opt/ovenmediaengine/bin/edge_conf/Server.xml (Of course inside docker container):

<?xml version="1.0" encoding="UTF-8" ?>

<Server version="8">
    <Name>OvenMediaEngine</Name>
    <!-- Host type (origin/edge) -->
    <Type>edge</Type>
    <!-- Specify IP address to bind (* means all IPs) -->
    <IP>*</IP>

    <!-- Settings for the ports to bind -->
    <Bind>
        <Providers>
            <!-- Currently, OME doesn't support using the specified port for OVT Provider -->
       <RTSP>
           <Port>8554</Port>
       </RTSP>
        </Providers>

        <Publishers>
            <WebRTC>
                <Signalling>
                    <Port>3333</Port>
                </Signalling>
                <IceCandidates>
                    <IceCandidate>${env:OME_ICE_CANDIDATES:*:10000-10005/udp}</IceCandidate>
                </IceCandidates>
            </WebRTC>
        </Publishers>
    </Bind>

    <!-- P2P works only in WebRTC -->
    <!--
    <P2P>
        <MaxClientPeersPerHostPeer>2</MaxClientPeersPerHostPeer>
    </P2P>
        -->

    <VirtualHosts>
        <!-- You can use wildcard like this to include multiple XMLs -->
        <VirtualHost include="VHost*.xml" />
        <VirtualHost>
            <Name>default</Name>
            <Host>
                <Names>
                                    <Name>*</Name>
                </Names>
            </Host>
            <!-- Settings for ProxyPass (It can specify origin for each path) -->
            <Origins>
                           <Origin>
                                 <Location>/app/bypass_stream</Location>
                                       <Pass>
                                             <Scheme>rtsp</Scheme>
                                             <Urls><Url>192.168.1.40:8554/unicast</Url></Urls>
                                       </Pass>
                              </Origin>         
            </Origins>
        </VirtualHost>
    </VirtualHosts>
</Server>

My /opt/ovenmediaengine/bin/origin_conf/Server.xml:

<?xml version="1.0" encoding="UTF-8" ?>

<Server version="8">
    <Name>OvenMediaEngine</Name>
    <!-- Host type (origin/edge) -->
    <Type>origin</Type>
    <!-- Specify IP address to bind (* means all IPs) -->
    <IP>*</IP>

    <!-- Settings for the ports to bind -->
    <Bind>
        <Providers>
        <RTSP>
            <Port>8554</Port>
        </RTSP>
        </Providers>

        <Publishers>
            <WebRTC>
                <Signalling>
                    <Port>3333</Port>
                    <!-- <TLSPort>3334</TLSPort> -->
                </Signalling>
                <IceCandidates>
                    <IceCandidate>${env:OME_ICE_CANDIDATES:*:10000-10005/udp}</IceCandidate>
                </IceCandidates>
            </WebRTC>
        </Publishers>
    </Bind>

    <VirtualHosts>
        <!--
            You can include multiple XML files by doing the following:
            <VirtualHost include="sites-enabled/*.xml" />
        -->
        <VirtualHost include="VHost*.xml" />
        <VirtualHost>
            <Name>default</Name>

            <!-- Settings for multi ip/domain and TLS -->
            <Host>
                <Names>
                    <Name>*</Name>
                </Names>
            </Host>

            <!-- Settings for applications -->
            <Applications>
                <Application>
                    <Name>app</Name>
                    <!-- Application type (live/vod) -->
                    <Type>live</Type>
                    <OutputProfiles>
                        <OutputProfile>
                            <Name>bypass_stream</Name>
                                                        <OutputStreamName>${OriginStreamName}</OutputStreamName>
                            <Encodes>
                                <Audio>
                                    <Bypass>true</Bypass>
                                </Audio>
                                <Video>
                                    <Bypass>true</Bypass>
                                </Video>
                            </Encodes>
                        </OutputProfile>
                    </OutputProfiles>
                    <Providers>
                        <RTSPPull />
                    </Providers>
                    <Publishers>
                   <!--
                        <SessionLoadBalancingThreadCount>8</SessionLoadBalancingThreadCount>
                   -->
                        <WebRTC>
                            <Timeout>30000</Timeout>
                        </WebRTC>
                    </Publishers>
                </Application>
            </Applications>
        </VirtualHost>
    </VirtualHosts>
</Server>

/var/log/ovenmediaengine/ovenmediaengine.log:

[2021-02-07 04:34:27.357] I [OvenMediaEngine:1] Config | config_manager.cpp:152  | Trying to set logfile in directory... (/var/log/ovenmediaengine)
[2021-02-07 04:34:27.358] I [OvenMediaEngine:1] Config | config_manager.cpp:48   | Trying to load configurations... (origin_conf/Server.xml)
[2021-02-07 04:34:27.359] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:28   | OvenMediaEngine v0.10.11 is started on [2838a24992a5] (Linux x86_64 - 5.4.0-65-generic, #73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021)
[2021-02-07 04:34:27.359] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:30   | With modules:
[2021-02-07 04:34:27.359] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:31   |   FFmpeg 3.4.7 OME
[2021-02-07 04:34:27.359] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:32   |     Configuration: --prefix=/opt/ovenmediaengine --enable-gpl --enable-nonfree --extra-cflags=-I/opt/ovenmediaengine/include --extra-ldflags='-L/opt/ovenmediaengine/lib -Wl,-rpath,/opt/ovenmediaengine/lib' --extra-libs=-ldl --enable-shared --disable-static --disable-debug --disable-doc --disable-programs --disable-avdevice --disable-dct --disable-dwt --disable-lsp --disable-lzo --disable-rdft --disable-faan --disable-pixelutils --enable-zlib --enable-libopus --enable-libvpx --enable-libfdk_aac --enable-libx264 --enable-libx265 --disable-everything --enable-encoder='libvpx_vp8,libvpx_vp9,libopus,libfdk_aac,libx264,libx265,mjpeg,png' --enable-decoder='aac,aac_latm,aac_fixed,h264,hevc' --enable-parser='aac,aac_latm,aac_fixed,h264,hevc' --enable-network --enable-protocol=tcp --enable-protocol=udp --enable-protocol='rtp,file,rtmp' --enable-demuxer=rtsp --enable-muxer='mp4,webm,mpegts,flv,mpjpeg' --enable-filter='asetnsamples,aresample,aformat,channelmap,channelsplit,scale,transpose,fps,settb,asettb,format'
[2021-02-07 04:34:27.359] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:33   |     libavformat: 57.83.100
[2021-02-07 04:34:27.359] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:34   |     libavcodec: 57.107.100
[2021-02-07 04:34:27.359] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:35   |     libavutil: 55.78.100
[2021-02-07 04:34:27.359] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:36   |     libavfilter: 6.107.100
[2021-02-07 04:34:27.359] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:37   |     libswresample: 2.9.100
[2021-02-07 04:34:27.359] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:38   |     libswscale: 4.8.100
[2021-02-07 04:34:27.359] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:39   |   SRT: 1.3.3
[2021-02-07 04:34:27.359] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:40   |   SRTP: libsrtp2 2.2.0
[2021-02-07 04:34:27.359] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:41   |   OpenSSL: OpenSSL 1.1.0g  2 Nov 2017
[2021-02-07 04:34:27.359] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:42   |     Configuration: compiler: gcc -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPADLOCK_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/opt/ovenmediaengine\"" -DENGINESDIR="\"/opt/ovenmediaengine/lib/engines-1.1\""  -Wa,--noexecstack
[2021-02-07 04:34:27.359] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:43   |   JsonCpp: 1.9.3
[2021-02-07 04:34:27.361] I [OvenMediaEngine:1] OvenMediaEngine | banner.cpp:44   |   jemalloc: 5.2.1-0-gea6b3e973b477b8061e0076bb257dbd7f3faa756
[2021-02-07 04:34:27.361] I [OvenMediaEngine:1] APIServer | api_server.cpp:30   | API Server is disabled
[2021-02-07 04:34:27.367] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:112  | Trying to create a MediaRouter module
[2021-02-07 04:34:27.367] I [OvenMediaEngine:1] MediaRouter | mediarouter.cpp:40   | Mediarouter has been started.
[2021-02-07 04:34:27.367] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:115  | Trying to create a WebRTC Publisher module
[2021-02-07 04:34:27.367] I [OvenMediaEngine:1] Signalling.P2P | rtc_p2p_manager.cpp:27   | P2P is disabled in the configuration
[2021-02-07 04:34:27.368] I [OvenMediaEngine:1] Ice | ice_port.cpp:91   | ICE port is bound to 0.0.0.0:10000/UDP (0x55c692a577e0)
[2021-02-07 04:34:27.369] I [OvenMediaEngine:1] Ice | ice_port.cpp:91   | ICE port is bound to 0.0.0.0:10001/UDP (0x55c692a5aec0)
[2021-02-07 04:34:27.369] I [OvenMediaEngine:1] Ice | ice_port.cpp:91   | ICE port is bound to 0.0.0.0:10002/UDP (0x55c692a5e5f0)
[2021-02-07 04:34:27.369] I [OvenMediaEngine:1] Ice | ice_port.cpp:91   | ICE port is bound to 0.0.0.0:10003/UDP (0x55c692a61e20)
[2021-02-07 04:34:27.369] I [OvenMediaEngine:1] Ice | ice_port.cpp:91   | ICE port is bound to 0.0.0.0:10004/UDP (0x55c692a65610)
[2021-02-07 04:34:27.369] I [OvenMediaEngine:1] Ice | ice_port.cpp:91   | ICE port is bound to 0.0.0.0:10005/UDP (0x55c692a68e40)
[2021-02-07 04:34:27.369] I [OvenMediaEngine:1] WebRTC | webrtc_publisher.cpp:92   | WebRTC Publisher is listening on 0.0.0.0:3333...
[2021-02-07 04:34:27.369] I [OvenMediaEngine:1] Publisher | publisher.cpp:19   | WebRTC Publisher has been started.
[2021-02-07 04:34:27.369] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:116  | Trying to create a HLS Publisher module
[2021-02-07 04:34:27.370] W [OvenMediaEngine:1] HLS | hls_publisher.cpp:38   | HLS Publisher is disabled by configuration
[2021-02-07 04:34:27.370] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:117  | Trying to create a MPEG-DASH Publisher module
[2021-02-07 04:34:27.370] W [OvenMediaEngine:1] DASH | dash_publisher.cpp:35   | DASH Publisher is disabled by configuration
[2021-02-07 04:34:27.370] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:118  | Trying to create a Low-Latency MPEG-DASH Publisher module
[2021-02-07 04:34:27.370] W [OvenMediaEngine:1] LLDASH | cmaf_publisher.cpp:35   | LLDASH Publisher is disabled by configuration
[2021-02-07 04:34:27.370] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:119  | Trying to create a OVT Publisher module
[2021-02-07 04:34:27.370] W [OvenMediaEngine:1] OVT | ovt_publisher.cpp:39   | OVTPublisher is disabled by configuration
[2021-02-07 04:34:27.370] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:120  | Trying to create a File Publisher module
[2021-02-07 04:34:27.371] I [OvenMediaEngine:1] Publisher | publisher.cpp:19   | FilePublisher has been started.
[2021-02-07 04:34:27.371] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:121  | Trying to create a RtmpPush Publisher module
[2021-02-07 04:34:27.371] I [OvenMediaEngine:1] Publisher | publisher.cpp:19   | RTMPPushPublisher has been started.
[2021-02-07 04:34:27.371] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:122  | Trying to create a Thumbnail Publisher module
[2021-02-07 04:34:27.371] W [OvenMediaEngine:1] Thumbnail | thumbnail_publisher.cpp:46   | ThumbnailPublisher is disabled by configuration
[2021-02-07 04:34:27.371] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:125  | Trying to create a Transcoder module
[2021-02-07 04:34:27.371] I [OvenMediaEngine:1] Transcoder | transcoder.cpp:38   | Transcoder has been started.
[2021-02-07 04:34:27.371] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:128  | Trying to create a MPEG-TS Provider module
[2021-02-07 04:34:27.371] W [OvenMediaEngine:1] MpegtsProvider | mpegts_provider.cpp:178  | MPEGTSProvider is disabled by configuration
[2021-02-07 04:34:27.371] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:129  | Trying to create a RTMP Provider module
[2021-02-07 04:34:27.371] W [OvenMediaEngine:1] RTMPProvider | rtmp_provider.cpp:58   | RTMPProvider is disabled by configuration
[2021-02-07 04:34:27.372] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:130  | Trying to create a OVT Provider module
[2021-02-07 04:34:27.372] I [OvenMediaEngine:1] Provider | provider.cpp:37   | OVTProvider has been started.
[2021-02-07 04:34:27.372] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:131  | Trying to create a RTSPC Provider module
[2021-02-07 04:34:27.372] I [OvenMediaEngine:1] Provider | provider.cpp:37   | RTSPCProvider has been started.
[2021-02-07 04:34:27.372] I [OvenMediaEngine:1] OvenMediaEngine | main.cpp:134  | All modules are initialized successfully
[2021-02-07 04:34:27.372] I [OvenMediaEngine:1] Monitor | monitoring.cpp:43   | Create HostMetrics(default) for monitoring
[2021-02-07 04:34:27.372] I [OvenMediaEngine:1] Orchestrator | orchestrator_internal.cpp:608  | Trying to create an application: [#default#app]
[2021-02-07 04:34:27.372] I [OvenMediaEngine:1] Monitor | host_metrics.cpp:52   | Create ApplicationMetrics(#default#app) for monitoring
[2021-02-07 04:34:27.372] I [OvenMediaEngine:1] MediaRouter | mediarouter_application.cpp:44   | Created Mediarouter application. application id(0), app(#default#app), worker(2)
[2021-02-07 04:34:27.372] I [OvenMediaEngine:1] MediaRouter | mediarouter_application.cpp:99   | Started Mediarouter application. application id(0), app(#default#app)
[2021-02-07 04:34:27.372] I [OvenMediaEngine:1] MediaRouter | mediarouter.cpp:71   | Created Mediarouter. app(#default#app)
[2021-02-07 04:34:27.373] I [OvenMediaEngine:1] Publisher | application.cpp:31   | WebRTC Publisher Application/#default#app/0 ApplicationWorker has been created
[2021-02-07 04:34:27.373] I [OvenMediaEngine:1] Publisher | application.cpp:31   | WebRTC Publisher Application/#default#app/1 ApplicationWorker has been created
[2021-02-07 04:34:27.373] I [OvenMediaEngine:1] Publisher | application.cpp:198  | WebRTC Publisher Application has created [#default#app] application
[2021-02-07 04:34:27.373] I [OvenMediaEngine:1] Publisher | publisher.cpp:65   | HLS publisher is disabled in #default#app application, so it was not created
[2021-02-07 04:34:27.373] I [OvenMediaEngine:1] Publisher | publisher.cpp:65   | DASH publisher is disabled in #default#app application, so it was not created
[2021-02-07 04:34:27.373] I [OvenMediaEngine:1] Publisher | publisher.cpp:65   | LLDASH publisher is disabled in #default#app application, so it was not created
[2021-02-07 04:34:27.373] I [OvenMediaEngine:1] Publisher | publisher.cpp:65   | OVT publisher is disabled in #default#app application, so it was not created
[2021-02-07 04:34:27.373] I [OvenMediaEngine:1] Publisher | publisher.cpp:65   | File publisher is disabled in #default#app application, so it was not created
[2021-02-07 04:34:27.373] I [OvenMediaEngine:1] Publisher | publisher.cpp:65   | RTMPPush publisher is disabled in #default#app application, so it was not created
[2021-02-07 04:34:27.374] I [OvenMediaEngine:1] Publisher | publisher.cpp:65   | Thumbnail publisher is disabled in #default#app application, so it was not created
[2021-02-07 04:34:27.374] I [OvenMediaEngine:1] Transcoder | transcoder.cpp:73   | Transcoder has created [config][#default#app] application
[2021-02-07 04:34:27.374] I [OvenMediaEngine:1] Provider | provider.cpp:87   | MPEG-TS provider is disabled in #default#app application, so it was not created
[2021-02-07 04:34:27.374] I [OvenMediaEngine:1] Provider | provider.cpp:87   | RTMP provider is disabled in #default#app application, so it was not created
[2021-02-07 04:34:27.374] I [OvenMediaEngine:1] Provider | provider.cpp:87   | OVT provider is disabled in #default#app application, so it was not created
[2021-02-07 04:34:27.374] I [OvenMediaEngine:1] Provider | application.cpp:46   | RTSPCProvider has created [#default#app] application
[2021-02-07 04:35:06.976] I [PhyPortWorker:10] Signalling | rtc_signalling_server.cpp:129  | New client is connected: <ClientSocket: 0x7fb3d0000b90, #19, state: 4, TCP, 192.168.1.34:42888>
[2021-02-07 04:35:06.983] E [PhyPortWorker:10] Orchestrator | orchestrator.cpp:478  | Could not find Origin for the stream: [#default#/]
[2021-02-07 04:35:06.983] E [PhyPortWorker:10] Signalling | rtc_signalling_server.cpp:219  | Cannot find stream [#default#/]
[2021-02-07 04:35:06.983] I [PhyPortWorker:10] Signalling | rtc_signalling_server.cpp:266  | Client is disconnected: <WebSocketClient: 0x7fb3d4002210, <ClientSocket: 0x7fb3d0000b90, #19, state: 4, TCP, 192.168.1.34:42888>> (#default# / , ufrag: local: (N/A), remote: (N/A))
[2021-02-07 04:36:44.069] I [PhyPortWorker:7] Signalling | rtc_signalling_server.cpp:129  | New client is connected: <ClientSocket: 0x7fb3d0000b90, #20, state: 4, TCP, 192.168.1.34:43770>
[2021-02-07 04:36:44.079] E [PhyPortWorker:7] Orchestrator | orchestrator.cpp:478  | Could not find Origin for the stream: [#default#app/bypass_stream]
[2021-02-07 04:36:44.079] E [PhyPortWorker:7] Signalling | rtc_signalling_server.cpp:219  | Cannot find stream [#default#app/bypass_stream]
[2021-02-07 04:36:44.079] I [PhyPortWorker:7] Signalling | rtc_signalling_server.cpp:266  | Client is disconnected: <WebSocketClient: 0x7fb3cc0020f0, <ClientSocket: 0x7fb3d0000b90, #20, state: 4, TCP, 192.168.1.34:43770>> (#default#app / bypass_stream, ufrag: local: (N/A), remote: (N/A))

For the test, I am using /OvenPlayer/dist/development/index.html and tried these configurations:

<script>
        const totalTestSources = [
        {
            file: "ws://192.168.1.41:3333",
            type: "webrtc",
            stream: "bypass_stream", // OME stream name
            application: "app", // OME application name
            default: true
        }
        ];
        OvenPlayer.debug(true);
        var player = OvenPlayer.create("player", {
            debug : true,
            sources: totalTestSources,
                webrtcConfig: {
        generatePublicCandidate: false
    }
        }, );
        hljs.initHighlightingOnLoad();
    </script>

and

 {
            file: "ws://192.168.1.41:3333/app/bypass_stream",
            type: "webrtc",
            stream: "bypass_stream", // OME stream name
            application: "app", // OME application name
            default: true
}
KVAnton-WEB commented 3 years ago

Okay, I'm stupid. I am newbie in Docker and have not started edge-version. I suspected that something was wrong, and that helped me too: https://hub.docker.com/r/airensoft/ovenmediaengine (I think it is necessary to add something about this to the documentation)

KVAnton-WEB commented 3 years ago

Now my LAN latency is 250-300ms (playing through OvenPlayer). I have 100-150ms when playing on PC via ffplay I'm happy with this result, it's cool

osvaldo96-reyes commented 2 years ago

hola que tal tambien estoy emepzando con docker pero tengo el mismo error no me sale mi transmision como lo solucionaste saludos