Skip to content

RTMP data channel caues ffmpeg analyzeduration very slow. #3767

@zh19900725

Description

@zh19900725

Note: Please read FAQ before file an issue, see #2716

Description

The srs develop branch is used here, and it was found that the initial loading of RTMP is always particularly slow. After troubleshooting, it was found that this is because there is always an extra channel in RTMP, but this channel does not output. Looking at the ffpmeg source code, it will cause analyzeduration to be stuck in a loop until it reaches the maximum value, which makes the initial loading particularly slow.

  1. SRS Version:
    develop

  2. SRS Config:

listen              2035;
max_connections     10000
srs_log_level       trace;
# For log rotation, you need to install the logrotate plugin: https://ossrs.net/lts/zh-cn/docs/v5/doc/log-rotate
pid                  /data/logs/srslog/srs.pid;
ff_log_dir           /data/logs/srslog;
srs_log_file         /data/logs/srslog/srs.log;

http_api {
    enabled         on;
    listen          9008;
    crossdomain     on;
}

heartbeat {
    enabled         on;
    interval        9.3;
    url             http://XXXX/invoke/heartbeat?env=0;
    device_id       "srs1";
    summaries       off;
}

rtc_server {
    enabled on;
    listen 443;
    tcp {
        enabled on;
        listen 443;
    }
    protocol tcp;
    candidate *;
}

http_server {
    enabled         on;
    listen          9008;
    dir             /run/media;
}

vhost __defaultVhost__ {
    tcp_nodelay     on;
    min_latency     on;

    play {
        gop_cache       off;
        queue_length    10;
        mw_latency      100;
    }

    publish {
        mr off;
    }
    hls {
        enabled         on;
        hls_path        /run/media;
        hls_fragment    4;
        hls_window      10;
    }

    rtc {
        enabled on;
        nack on;
        twcc on;
        stun_timeout 30;
        dtls_role passive;
        rtmp_to_rtc on;
        rtc_to_rtmp off;
    }

    http_remux {
        enabled     on;
    }

    http_hooks {
        enabled        on;
        on_hls         http://XXXX/invoke/onHls?env=0;
        on_play        http://XXXX/invoke/onPlay?env=0;
        on_unpublish   http://XXXX/invoke/onUnPublish?env=0;
        on_publish     http://XXXX/invoke/onPublish?env=0;
        on_stop        http://XXXX/invoke/onStop?env=0;
    }
}

Replay

This is a recurring issue. After deployment, pulling RTMP can reproduce it, there will be an extra channel which is
Stream #0:0: Data: none, and an error will be reported below: Unsupported codec with id 0 for input stream 0.

image

Expect

Do not affect the analyzeduration, let it quickly complete the analysis and return the data. I know many people would say that it's fine to reduce this time, but this requires constraints on the playback end, and many times, constraining others is uncontrollable.

TRANS_BY_GPT4

Metadata

Metadata

Assignees

Labels

CodecHEVC, FFmpeg for ingesting, trascoding or codec.TransByAITranslated by AI/GPT.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions