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

WebRTC: Support config the bitrate of transcoding AAC to Opus. v5.0.167, v6.0.60 #3515

Merged

Conversation

chundonglinlin
Copy link
Member

RTC support config audio bitrate by opus_bitrate or aac_bitrate.

# WebRTC streaming config for SRS.
# @see full.conf for detail config.

listen              1935;
max_connections     1000;
daemon              off;
srs_log_tank        console;

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

http_api {
    enabled         on;
    listen          1985;
}
stats {
    network         0;
}
rtc_server {
    enabled on;
    listen 8000; # UDP port
    # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
    candidate $CANDIDATE;
}

vhost __defaultVhost__ {
    rtc {
        enabled     on;
        # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
        rtmp_to_rtc on;
        opus_bitrate 128000;
        # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
        rtc_to_rtmp on;
        aac_bitrate 96000;
    }
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
}


trunk/conf/full.conf Outdated Show resolved Hide resolved
trunk/conf/full.conf Outdated Show resolved Hide resolved
@winlinvip winlinvip changed the title WebRTC: Support config the bitrate of transcoding AAC to Opus. WebRTC: Support config the bitrate of transcoding AAC to Opus. v5.0.167, v6.0.60 Jul 18, 2023
@winlinvip winlinvip merged commit 3fa4f66 into ossrs:develop Jul 18, 2023
winlinvip pushed a commit that referenced this pull request Jul 18, 2023
…67, v6.0.60 (#3515)

---------

Co-authored-by: john <hondaxiao@tencent.com>
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 29, 2023
@fairy-ju
Copy link

fairy-ju commented Sep 8, 2023

RTC support config audio bitrate by opus_bitrate or aac_bitrate.

# WebRTC streaming config for SRS.
# @see full.conf for detail config.

listen              1935;
max_connections     1000;
daemon              off;
srs_log_tank        console;

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

http_api {
    enabled         on;
    listen          1985;
}
stats {
    network         0;
}
rtc_server {
    enabled on;
    listen 8000; # UDP port
    # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
    candidate $CANDIDATE;
}

vhost __defaultVhost__ {
    rtc {
        enabled     on;
        # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
        rtmp_to_rtc on;
        opus_bitrate 128000;
        # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
        rtc_to_rtmp on;
        aac_bitrate 96000;
    }
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
}

@chundonglinlin您好,我删除并使用git clone -b develop https://gitee.com/ossrs/srs.git 重装了最新的dev版本,但发现不管是rtmp到WebRTC还是srt到WebRTC,音频码率都还是保持默认值不随配置文件而变化,我配置文件里面写的192000,但实际只有大概64000,能帮忙看看问题所在吗,谢谢!下面是我的配置文件:

Hello, I have deleted and reinstalled the latest dev version using git clone -b develop https://gitee.com/ossrs/srs.git. However, I found that regardless of whether it is RTMP to WebRTC or SRT to WebRTC, the audio bitrate still remains the default value and does not change with the configuration file. I wrote 192000 in my configuration file, but in reality, it's only about 64000. Could you help me see what the problem is? Thank you! Below is my configuration file:


listen              1935;
max_connections     1000;
daemon              off;
srs_log_tank        console;

http_api {
    enabled         on;
    listen          1985;
    https {
        # Whether enable HTTPS API.
        # default: off
        enabled on;
        # The listen endpoint for HTTPS API.
        # default: 1990
        listen 1990;
        # The SSL private key file, generated by:
        #       openssl genrsa -out server.key 2048
        # default: ./conf/server.key
        key ./conf/server.key;
        # The SSL public cert file, generated by:
        #       openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net"
        # default: ./conf/server.crt
        cert ./conf/server.crt;
    }
}

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

srt_server {
    enabled on;
    listen 10080;
    maxbw 1000000000;
    connect_timeout 4000;
    peerlatency 0;
    recvlatency 0;
}

rtc_server {
    enabled on;
    # Listen at udp://8000
    listen 8000;
    #
    # The $CANDIDATE means fetch from env, if not configed, use * as default.
    #
    # The * means retrieving server IP automatically, from all network interfaces,
    # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
    #candidate $CANDIDATE;
    candidate *; #支持任意IP,就意味着让服务器自己选择,先选公网IP,然后选内网IP
    use_auto_detect_network_ip on; #若关闭这个功能,则不会自动选择IP
    ip_family ipv4; #自动选择IP时,选择IPv4还是IPv6的地址
    api_as_candidates on; #是否开启这个功能。若API是单独的服务器,可以关闭这个功能
    resolve_api_domain on; #若API是域名,是否将域名解析为IP地址。注意Firefox不支持域名,所以一般是推荐打开的
    keep_api_domain on;  #是否保留API的域名,支持域名解析的客户端可以自己解析IP地址,避免服务器实现解析
}

# @doc https://github.com/ossrs/srs/issues/1147#issuecomment-577607026
vhost __defaultVhost__ {
    srt {
        enabled     on;
    }
    rtc {
        enabled     on;
        # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc
        rtmp_to_rtc on;
		opus_bitrate 192000;
        # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp
        rtc_to_rtmp on;
		aac_bitrate 192000;
    }
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT.
Projects
None yet
4 participants