Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SRT stream not available via HTTP-FLV #4242

Open
pannal opened this issue Nov 21, 2024 · 3 comments
Open

SRT stream not available via HTTP-FLV #4242

pannal opened this issue Nov 21, 2024 · 3 comments
Labels
EnglishNative This issue is conveyed exclusively in English.

Comments

@pannal
Copy link

pannal commented Nov 21, 2024

Describe the bug
I'm pushing a h264 stream using OBS to SRS's SRT endpoint. From how I understand the documentation, this should then be exposed via /app/live/key.flv, but it's unplayable (timeout via mpegts.js and VLC). Am I missing something?

SRS is behind an NGINX reverse proxy if that helps, config:

    location / {
        include snippets/authelia/authrequest.conf;
        include snippets/proxy.conf;
        proxy_pass http://127.0.0.1:18080/$request_uri;
    }


    # For SRS homepage, console and players
    #   http://r.ossrs.net/console/
    #   http://r.ossrs.net/players/
    location ~ ^/(console|players)/ {
        include snippets/authelia/authrequest.conf;
        include snippets/proxy.conf;
        proxy_pass http://127.0.0.1:18080/$request_uri;
    }
    # For SRS streaming, for example:
    #   http://r.ossrs.net/live/livestream.flv
    #   http://r.ossrs.net/live/livestream.m3u8
    location ~ ^/.+/.*\.(flv|m3u8|ts|aac|mp3)$ {
        #include snippets/authelia/authrequest.conf;
        #include snippets/proxy.conf;
        proxy_pass http://127.0.0.1:18080$request_uri;
    }
    # For SRS backend API for console.
    # For SRS WebRTC publish/play API.
    location ~ ^/(api|rtc)/ {
        proxy_pass http://127.0.0.1:1985$request_uri;
    }

SRS config:

# docker config for srs.
# @see full.conf for detail config.

listen              1935;
max_connections     1000;
# For docker, please use docker logs to manage the logs of SRS.
# See https://docs.docker.com/config/containers/logging/
srs_log_tank        console;
daemon              off;
http_api {
    enabled         on;
    listen          1985;
}
http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
}
rtc_server {
    enabled off;
    listen 8000;
    # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
    candidate $CANDIDATE;
}
#srt_server {
#    enabled on;
#    listen 10080;
#    connect_timeout 4000;
#    peerlatency 300; # RTT * 3
#    recvlatency 300; # RTT * 3
#    latency 300; # RTT * 3
#    tlpktdrop on;
#    tsbpdmode on;
#}
srt_server {
    enabled on;
    listen 10080;
    connect_timeout 4000;
    peerlatency 0;
    recvlatency 0;
    latency 0;
    tlpktdrop off;
    tsbpdmode off;
}
vhost __defaultVhost__ {
    hls {
        enabled         on;
    }
    srt {
        enabled     on;
        srt_to_rtmp on;
    }
    http_remux {
        enabled     on;
        mount       /[app]/[stream].flv;
    }
    rtc {
        enabled     off;
        # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
        rtmp_to_rtc off;
        # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
        rtc_to_rtmp off;
    }
}

Docker-Compose:

srs:
    container_name: srs
    image: ossrs/srs:v6
    volumes:
      - /etc/srs/docker.conf:/usr/local/srs/conf/docker.conf
    ports:
      - 1339:1935/tcp
      - 127.0.0.1:1985:1985
      - 127.0.0.1:18080:8080
      - 8000:8000/udp
      - 10080:10080/udp

Version
SRS V6 docker (via dockerhub), SRS/6.0.155

@winlinvip winlinvip added the EnglishNative This issue is conveyed exclusively in English. label Nov 21, 2024
@suzp1984
Copy link
Contributor

The nginx config its proxy:

location ~ ^/.+/.*\.(flv|m3u8|ts|aac|mp3)$ {
        #include snippets/authelia/authrequest.conf;
        #include snippets/proxy.conf;
        proxy_pass http://127.0.0.1:18080$request_uri;
    }

proxy to 127.0.0.0:18080, but srs config its http server listen on 8080:

http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
}

@pannal
Copy link
Author

pannal commented Nov 22, 2024

Yes, the port is remapped in docker to expose on 18080 because the port is already in use on the host machine from another service.

To be clear: this Config works when directly streaming to RTMP and using the .flv URL in VLC or mpegts.js.

Only when publishing using SRT the flv is not available/doesn't load (times out).

@pannal
Copy link
Author

pannal commented Nov 22, 2024

Can I get you some logs? Any debug settings I need?

Edit: Updated the first post with the docker config and specific version of SRS 6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EnglishNative This issue is conveyed exclusively in English.
Projects
None yet
Development

No branches or pull requests

3 participants