[*] 码率配置

This commit is contained in:
acgist
2023-08-26 10:12:00 +08:00
parent 54d8c04b8b
commit 7e4230c214
6 changed files with 29 additions and 22 deletions

View File

@@ -28,7 +28,7 @@ public class MediaVideoProperties {
*/
private Format format;
/**
* 码率:600|1200|1500|1800
* 码率:400|800|1200|1600
* 码率影响画质
*/
private Integer bitrate;

View File

@@ -73,21 +73,32 @@ module.exports = {
// Router配置https://mediasoup.org/documentation/v3/mediasoup/api/#RouterOptions
routerOptions: {
mediaCodecs: [
// OPUS PCMA PCMU G722
{
kind : "audio",
mimeType : "audio/opus",
clockRate: 48000,
channels : 2,
},
{
kind : "audio",
mimeType : "audio/pcmu",
clockRate: 8000,
channels : 1,
},
{
kind : "audio",
mimeType : "audio/pcma",
clockRate: 8000,
channels : 1,
},
{
kind : "video",
mimeType : "video/VP8",
clockRate : 90000,
parameters: {
"x-google-start-bitrate": 1000,
"x-google-start-bitrate": 400,
// "x-google-min-bitrate": 800,
// "x-google-max-bitrate": 1800,
// "x-google-max-bitrate": 1600,
},
},
{
@@ -96,9 +107,9 @@ module.exports = {
clockRate : 90000,
parameters: {
"profile-id" : 2,
"x-google-start-bitrate": 1000,
"x-google-start-bitrate": 400,
// "x-google-min-bitrate": 800,
// "x-google-max-bitrate": 1800,
// "x-google-max-bitrate": 1600,
},
},
{
@@ -109,9 +120,9 @@ module.exports = {
"packetization-mode" : 1,
"profile-level-id" : "4d0032",
"level-asymmetry-allowed": 1,
"x-google-start-bitrate" : 1000,
"x-google-start-bitrate" : 400,
// "x-google-min-bitrate": 800,
// "x-google-max-bitrate": 1800,
// "x-google-max-bitrate": 1600,
},
},
{
@@ -122,9 +133,9 @@ module.exports = {
"packetization-mode" : 1,
"profile-level-id" : "42e01f",
"level-asymmetry-allowed": 1,
"x-google-start-bitrate" : 1000,
"x-google-start-bitrate" : 400,
// "x-google-min-bitrate": 800,
// "x-google-max-bitrate": 1800,
// "x-google-max-bitrate": 1600,
},
},
],
@@ -154,10 +165,10 @@ module.exports = {
announcedIp: process.env.MEDIASOUP_ANNOUNCED_IP || "127.0.0.1",
},
],
initialAvailableOutgoingBitrate: 1000000,
initialAvailableOutgoingBitrate: 400000,
minimumAvailableOutgoingBitrate: 800000,
maxSctpMessageSize : 262144,
maxIncomingBitrate : 1800000,
maxIncomingBitrate : 1600000,
},
// PlainTransport配置https://mediasoup.org/documentation/v3/mediasoup/api/#PlainTransportOptions
plainTransportOptions: {

View File

@@ -1758,13 +1758,9 @@ class Taoyao {
};
me.push(message);
const {
minOutgoingBitrate,
maxOutgoingBitrate,
maxIncomingBitrate,
} = config.mediasoup.webRtcTransportOptions;
if(minOutgoingBitrate) {
await transport.setMinOutgoingBitrate(minOutgoingBitrate);
}
if(maxOutgoingBitrate) {
await transport.setMaxOutgoingBitrate(maxOutgoingBitrate);
}

View File

@@ -2793,9 +2793,9 @@ class Taoyao extends RemoteClient {
}
const track = videoTrack || await me.getVideoTrack();
const codecOptions = {
videoGoogleStartBitrate: 400,
videoGoogleMinBitrate : 800,
videoGoogleMaxBitrate : 1800,
videoGoogleStartBitrate: 1000,
videoGoogleMaxBitrate : 1600,
};
let codec;
if(me.forceVP8) {

View File

@@ -41,7 +41,7 @@ public class MediaVideoProperties {
@Schema(title = "格式", description = "格式", example = "VP8|VP9|H264|H265")
private Format format;
@Schema(title = "码率", description = "码率影响画质", example = "600|1200|1500|1800")
@Schema(title = "码率", description = "码率影响画质", example = "400|800|1200|1600")
private Integer bitrate;
@Schema(title = "帧率", description = "帧率影响流畅", example = "15|18|20|24|30|45")
private Integer frameRate;

View File

@@ -121,7 +121,7 @@ taoyao:
# 4KUD=UHD=4K
ud-video:
format: H264
bitrate: 1800
bitrate: 2000
frame-rate: 45
resolution: 4096*2160
# 2KQD=QHD=2K
@@ -139,13 +139,13 @@ taoyao:
# 高清视频HD=720P
hd-video:
format: H264
bitrate: 1000
bitrate: 800
frame-rate: 18
resolution: 1280*720
# 标清视频SD=480P
sd-video:
format: H264
bitrate: 800
bitrate: 400
frame-rate: 15
resolution: 720*480
# FFmpeg配置