ossrs / srs

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181.
https://ossrs.io
MIT License
25.34k stars 5.33k forks source link

PROTOCOL: HTTP-FLV performance issue, CPU Usage too high #755

Closed kioqq closed 4 years ago

kioqq commented 7 years ago

Hello @winlinvip . I have one more question :)

After i push stream(RTMP) from iOS and play .flv url in webplayer or VLC, srs usage 100% CPU why? o_o

VM: 4 core 8 gb mem 120gb ssd

screen shot 2017-01-31 at 6 44 51 pm

My config:

listen              1935;
max_connections     1000;

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

vhost __defaultVhost__ {

    transcode {

        enabled     on;
        ffmpeg      ./objs/ffmpeg/bin/ffmpeg;

        engine 720 {
            enabled         on;
            vfilter {
            }
            vcodec          libx264;
            vbitrate        1500;
            vfps            24;
            vwidth          1278;
            vheight         720;
            vthreads        16;
            vprofile        baseline;
            vpreset         veryfast;
            vparams {
                g           100;
            }
            acodec          libfdk_aac;
            abitrate        70;
            asample_rate    44100;
            achannels       2;
            aparams {
            }
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
        }
    }

    ############################

    tcp_nodelay     on
    min_latency     on;

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

    publish {
        mr off;
    }

    ############################

    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
}
winlinvip commented 7 years ago

What's your SRS version? How many streams? How many players? How to replay this issue?

kioqq commented 7 years ago

@winlinvip Latest version from repo (git clone), 1 stream (RTMP), 1 player (HTTP-FLV). The load on the CPU begins at the moment when I open the HTTP-FLV link in player. If open RTMP link is ok.

winlinvip commented 7 years ago

Please use 2.0release branch. No time to fix bugs of develop branch, because I'm changing it huge day by day.

kioqq commented 7 years ago

@winlinvip 2.0release branch works great, thank you! 👍

winlinvip commented 7 years ago

Reopen for maybe bug for SRS3.

kioqq commented 7 years ago

@winlinvip please check this bug in dev branch, it's very important for me. I try fix it but can't find this bug now x_x if i understand this is a problem in the muxing rtmp -> http-flv. I also try to find the bug. -__- I'll tell you if I find :))

kioqq commented 7 years ago

hmm interesting, i can't reproduce this bug in dev branch if build srs on mac os Sierra o_0 but it's easy reproduced on CentOS 6/7 and Ubuntu12

winlinvip commented 7 years ago

Please DON'T use dev branch, it's not available.

kioqq commented 7 years ago

@winlinvip I use 2.0release it's ok, thank you 👍 But streams in 3.0 open faster it's important for me, but .flv streams broken 😩 . And i just try fix it 😃

winlinvip commented 7 years ago

You can file a issue to fix the 2.0 to fast startup.

winlinvip commented 4 years ago

Fixed in SRS3