m1k1o / neko

A self hosted virtual browser that runs in docker and uses WebRTC.
https://neko.m1k1o.net/
Apache License 2.0
5.96k stars 449 forks source link

Having trouble getting RTMP streaming to work #274

Closed evilalmus closed 1 year ago

evilalmus commented 1 year ago

image I'm using: ghcr.io/m1k1o/neko/nvidia-google-chrome:latest I'm running in unraid behind a traefik reverse proxy. The browser does come up and I am able to log in and use it just fine. When I try to start an RTMP stream I get an error and this in the log:

2023-04-02 15:17:32,526 DEBG 'neko' stdout output:
0:01:10.062427099    19 0x14b02000bf90 ERROR           GST_PIPELINE subprojects/gstreamer/gst/parse/grammar.y:851:priv_gst_parse_yyparse: no element "rtmpsink"
0:01:10.062450909    19 0x14b02000bf90 ERROR           GST_PIPELINE subprojects/gstreamer/gst/parse/grammar.y:939:priv_gst_parse_yyparse: link has no sink [source=@0x14b08400a2b0]

2023-04-02 15:17:32,526 DEBG 'neko' stdout output:
0:01:10.062495281    19 0x14b02000bf90 ERROR           GST_PIPELINE subprojects/gstreamer/gst/parse/grammar.y:851:priv_gst_parse_yyparse: no element "voaacenc"
0:01:10.062499181    19 0x14b02000bf90 ERROR           GST_PIPELINE subprojects/gstreamer/gst/parse/grammar.y:939:priv_gst_parse_yyparse: link has no sink [source=@0x14b08400fde0]
0:01:10.062502491    19 0x14b02000bf90 ERROR           GST_PIPELINE subprojects/gstreamer/gst/parse/grammar.y:1039:priv_gst_parse_yyparse: link has no source [sink=mux@(nil)]

Any help would be appreciated, or if more info is needed, let me know.

m1k1o commented 1 year ago

It looks like there are missing some libraries when building or running gstreamer. I wonder what's needed for rtmpsink and voaacenc. Just adding them to build stage of gstreamer or runtime should fix this.

m1k1o commented 1 year ago

Looks like these two libvo-aacenc0 and librtmp1 are missing in runtime. Previously insalled using gstreamer1.0-plugins-bad but since we custom built gstreamer it was not included. Maybe we can get only dependencies without having installed their gstreamer?

m1k1o commented 1 year ago

@evilalmus this fixes the issue:

diff --git a/.docker/base/Dockerfile.nvidia b/.docker/base/Dockerfile.nvidia
index 625cfd6..6457306 100644
--- a/.docker/base/Dockerfile.nvidia
+++ b/.docker/base/Dockerfile.nvidia
@@ -22,6 +22,8 @@ RUN set -eux; \
         # Install build deps
         autopoint autoconf automake autotools-dev libtool gettext bison flex gtk-doc-tools \
         # Install libraries
+        librtmp-dev \
+        libvo-aacenc-dev \
         libtool-bin \
         libgtk2.0-dev \
         libgl1-mesa-dev \
@@ -172,7 +174,7 @@ RUN set -eux; \
     # install dependencies
     apt-get install -y --no-install-recommends wget ca-certificates supervisor; \
     apt-get install -y --no-install-recommends pulseaudio dbus-x11 xserver-xorg-video-dummy; \
-    apt-get install -y --no-install-recommends libcairo2 libxcb1 libxrandr2 libxv1 libopus0 libvpx6 libx264-155; \
+    apt-get install -y --no-install-recommends libcairo2 libxcb1 libxrandr2 libxv1 libopus0 libvpx6 libx264-155 libvo-aacenc0 librtmp1; \
     apt-get install -y --no-install-recommends libgtk-3-bin software-properties-common cabextract aptitude vim curl; \
     #
     # install fonts
evilalmus commented 1 year ago

Thank you @m1k1o I'll try to figure out how to make those changes unless you have an idea when this could maybe be pulled for the ghcr.io image?

m1k1o commented 1 year ago

@evilalmus i updated the file, currently CI is building. Will be soon available on the ghcr.io.

evilalmus commented 1 year ago

Getting closer. Thank you for getting this fix in so quickly. I am no longer getting that error. Now that I am past that I am seeing two new issues.

  1. If the stream key includes any special characters (in my case !) I get this error:
2023-04-03 15:35:34,436 DEBG 'neko' stdout output:
0:05:37.063166498    19 0x14ddd4002b60 ERROR                   rtmp :0:: RTMP URL: No :// in URL!

This is not a big deal, I can just change my stream key.

  1. Once I change my stream key to not have any special characters, instead of the above I get this error:
    2023-04-03 15:36:48,798 DEBG 'neko' stdout output:
    0:06:51.412981893    19 0x14ddc4004300 ERROR                   rtmp :0:: RTMP_ReadPacket, failed to read RTMP packet header

    I know the target is working as I can stream to it from OBS on this same network, If there is something else I am missing or doing wrong, I am unable to figure out what it is.