meetecho / simple-whip-server

Simple WHIP Server (based on the Janus WebRTC Server)
GNU General Public License v3.0
93 stars 24 forks source link

Problem streaming with OBS #12

Closed parwan42 closed 8 months ago

parwan42 commented 8 months ago

Hello,

I have set up Janus with the Simple-Whip-Server (SWS), SWS has successfully connected via WebSocket. I created a whip endpoint tester-1 with a token. OBS is configured to https://api.janus.nomadenflotte.de/whip/endpoint/tester-1 with token.

When I'm starting the stream, I get this error log:

[WARN] Video offered as 'sendonly', but we need 'inactive' for us: using 'inactive' [ERR] [sdp-utils.c:janus_sdp_get_codec_pt_full:780] Unsupported codec 'none' [WARN] Couldn't find codec we needed (none) in the offer, rejecting video [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but let's give it some time... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [WARN] [1532021703840573] ICE failed for component 1 in stream 1, but we're still waiting for some info so we don't care... (trickle pending, answer received, alert not set) [ERR] [ice.c:janus_ice_check_failed:2013] [1532021703840573] ICE failed for component 1 in stream 1... [janus.plugin.videoroom-0x7f9b740014a0] No WebRTC media anymore; 0x7f9bc8005b30 0x7f9bc8004950 [1532021703840573] WebRTC resources freed; 0x7f9bc8005b30 0x7f9b80003520 Detaching handle from JANUS VideoRoom plugin; 0x7f9bc8005b30 0x7f9b740014a0 0x7f9bc8005b30 0x7f9bc8004950 [1532021703840573] Handle and related resources freed; 0x7f9bc8005b30 0x7f9b80003520

lminiero commented 8 months ago

You're probably trying to publish to a room that doesn't support H.264 (which is the codec OBS will use).

parwan42 commented 8 months ago

Thanks for the super-quick response, Lorenzo!

[1234] description = Demo Room secret = publishers = 6 bitrate = 128000 fir_freq = 10 audiocodec = opus videocodec = h264 record = false ;rec_dir = /tmp/janus-videoroom

I tried h264, x264, H264

lminiero commented 8 months ago

Make sure you restart Janus when you modify configuration files.

parwan42 commented 8 months ago

sure, I run docker compose down && docker compose up -d after this I restart SWS and recreate the endpoint

Janus version: 1104 (1.1.4) Janus commit: 3c39ce8cf11c54cf6f1607030a47ac9db798389a Compiled on: Sat May 20 04:05:21 UTC 2023

Logger plugins folder: /usr/local/lib/janus/loggers [WARN] Couldn't access logger plugins folder...

Starting Meetecho Janus (WebRTC Server) v1.1.4

Checking command line arguments... Debug/log level is 4 Debug/log timestamps are disabled Debug/log colors are enabled Adding 'vmnet' to the ICE ignore list... Using 116.203.124.119 as local IP... Token based authentication disabled Initializing recorder code Initializing ICE stuff (Full mode, ICE-TCP candidates disabled, half-trickle, IPv6 support disabled) TURN REST API backend: (disabled) Crypto: OpenSSL >= 1.1.0 No cert/key specified, autogenerating some... Fingerprint of our certificate: E5:E7:88:E4:A7:4D:2C:64:8B:F5:FA:D7:84:FB:0E:D5:B9:4D:B3:3F:77:AA:38:61:74:16:92:4E:D9:B8:48:18 Event handlers support disabled Plugins folder: /usr/local/lib/janus/plugins Sessions watchdog started Joining Janus requests handler thread Loading plugin 'libjanus_echotest.so'... JANUS EchoTest plugin initialized! Loading plugin 'libjanus_nosip.so'... JANUS NoSIP plugin initialized! Loading plugin 'libjanus_sip.so'... JANUS SIP plugin initialized! Loading plugin 'libjanus_videoroom.so'... JANUS VideoRoom plugin initialized! Loading plugin 'libjanus_streaming.so'... JANUS Streaming plugin initialized! Loading plugin 'libjanus_videocall.so'... JANUS VideoCall plugin initialized! Loading plugin 'libjanus_textroom.so'... JANUS TextRoom plugin initialized! Loading plugin 'libjanus_recordplay.so'... JANUS Record&Play plugin initialized! Loading plugin 'libjanus_audiobridge.so'... JANUS AudioBridge plugin initialized! Transport plugins folder: /usr/local/lib/janus/transports Loading transport plugin 'libjanus_nanomsg.so'... JANUS Nanomsg transport plugin initialized! Loading transport plugin 'libjanus_http.so'... Nanomsg thread started HTTP transport timer started HTTP webserver started (port 8088, /janus path listener)... JANUS REST (HTTP/HTTPS) transport plugin initialized! Loading transport plugin 'libjanus_rabbitmq.so'... RabbitMQ SSL support disabled [WARN] RabbitMQ support disabled for both Janus and Admin API, giving up [WARN] The 'janus.transport.rabbitmq' plugin could not be initialized Loading transport plugin 'libjanus_pfunix.so'... [WARN] No Unix Sockets server started, giving up... [WARN] The 'janus.transport.pfunix' plugin could not be initialized Loading transport plugin 'libjanus_websockets.so'... libwebsockets logging: 0 Websockets server started (port 8188)... JANUS WebSockets transport plugin initialized! WebSockets thread started Creating new session: 4543127114168664; 0x7f34d4001ab0

parwan42 commented 8 months ago

Are all versions of Janus supporting WHIP? There is a 0.12.x release branch and a 1.x branch?

Could that be the issue?

parwan42 commented 8 months ago

Hi Lorenzo,

I finally got the server running with the VideoRoom demo. None of the Docker files linked around here did the trick, below is the configuration that I got working.

FROM ubuntu:20.04

RUN \
    apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get -y install curl g++-10 git nano vim net-tools htop libmicrohttpd-dev libjansson-dev libssl-dev libsofia-sip-ua-dev libglib2.0-dev libopus-dev libogg-dev libcurl4-openssl-dev liblua5.3-dev libconfig-dev pkg-config gengetopt libtool automake python3 python3-pip python3-setuptools python3-dev python3-wheel ninja-build libavcodec-dev libwebsockets-dev && \
    update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10

RUN pip3 install meson

WORKDIR /tmp

ENV LIBNICE_VERSION=0.1.18
ENV LIBSRTP_VERSION=v2.4.2
ENV JANUSGATEWAY_VERSION=v1.2.1
ENV CMAKE_VERSION=3.26.4

RUN curl -L -o /tmp/cmake-install.sh https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.sh \
      && chmod u+x /tmp/cmake-install.sh \
      && mkdir -p /usr \
      && /tmp/cmake-install.sh --skip-license --prefix=/usr \
      && rm /tmp/cmake-install.sh

RUN \
    DIR=/tmp/libnice && \
    mkdir -p ${DIR} && \
    cd ${DIR} && \
    curl -sLf https://github.com/libnice/libnice/archive/${LIBNICE_VERSION}.tar.gz | tar -zx --strip-components=1 && \
    meson --prefix=/usr build/ && \
    ninja -C build && \
    ninja -C build install && \
    rm -rf ${DIR}

RUN \
    DIR=/tmp/libsrtp && \
    mkdir -p ${DIR} && \
    cd ${DIR} && \
    curl -sLf https://github.com/cisco/libsrtp/archive/${LIBSRTP_VERSION}.tar.gz | tar -zx --strip-components=1 && \
    ./configure --prefix=/usr --enable-openssl && \
    make shared_library && \
    make install && \
    rm -rf ${DIR}

RUN \
    DIR=/tmp/janus-gateway && \
    mkdir -p ${DIR} && \
    cd ${DIR} && \
    curl -sLf https://github.com/meetecho/janus-gateway/archive/${JANUSGATEWAY_VERSION}.tar.gz | tar -zx --strip-components=1 && \
    sh autogen.sh && \
    ./configure --prefix=/opt/janus && \
    make && \
    make configs && \
    make install && \
    rm -rf ${DIR}

WORKDIR /app

COPY . /app

# Janus API HTTP
EXPOSE 8088/tcp
# Janus API HTTPS
EXPOSE 8089/tcp
# RTP Media
EXPOSE 20000-20100/udp
# NOTE: Usually we'd want a way larger Media/RTP port range
# but Docker is extremely slow at opening huge port ranges
# (see moby/moby#14288)

CMD exec /opt/janus/bin/janus --rtp-port-range=20000-20100 --nat-1-1=${DOCKER_IP} --configs-folder=/opt/janus/etc/janus
parwan42 commented 8 months ago

Now I have a persistent issue where if more than one stream connects to the server, the connection becomes unstable and streams are disconnected and reconnected all the time.

lminiero commented 8 months ago

I'm sorry but this repo is not for handling Janus usabilty issues, including configuration, deployment and management. I'd rather keep issues here only around the management of WHIP signalling. If using the Janus demos directly, without the WHIP part, gives you the same problems, you may want to refer to the Janus community group for more help on Janus itself.