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

远程视频质量 #57

Open
liuming1989 opened this issue Aug 8, 2021 · 13 comments
Open

远程视频质量 #57

liuming1989 opened this issue Aug 8, 2021 · 13 comments

Comments

@liuming1989
Copy link

使用过程中,远程视频的质量被压缩了,预览画面很清晰,但是对方看到的画面就像是被压缩了,查看依赖库,更改视频尺寸和fps没什么效果,请问有什么方式提高视频的质量嘛?目前看到所有的qq群都已经满了,能多开一个嘛

@ddssingsong
Copy link
Owner

有个设置最大码率的参数

@liuming1989
Copy link
Author

哦,能告诉我一下吗?我知道rtc-chat这里面有地方能设置视频的 分辨率 默认我看是 640X480,还有一个fps ,是这个地方吗?

@SinLT
Copy link

SinLT commented Aug 23, 2021

`public static final String VIDEO_CODEC_H264 = "H264";
public static final String VIDEO_CODEC_PARAM_START_BITRATE = "x-google-start-bitrate";
public static final String VIDEO_CODEC_PARAM_MAX_BITRATE = "x-google-max-bitrate";
public static final String VIDEO_CODEC_PARAM_MIN_BITRATE = "x-google-min-bitrate";
public static final int videoMaxBitrateKbps = 8000;
public static final int videoMinBitrateKbps = 8000;
public static final int videoStartBitrateKbps = 8000;
private static String setStartBitrate(String codec, boolean isVideoCodec, String sdpDescription, int bitrateKbps) {
String[] lines = sdpDescription.split("\r\n");
int rtpmapLineIndex = -1;
boolean sdpFormatUpdated = false;
String codecRtpMap = null;
// Search for codec rtpmap in format
// a=rtpmap: / [/]
String regex = "^a=rtpmap:(\d+) " + codec + "(/\d+)+[\r]?$";
Pattern codecPattern = Pattern.compile(regex);
for (int i = 0; i < lines.length; i++) {
Matcher codecMatcher = codecPattern.matcher(lines[i]);
if (codecMatcher.matches()) {
codecRtpMap = codecMatcher.group(1);
rtpmapLineIndex = i;
break;
}
}
if (codecRtpMap == null) {
Log.w(TAG, "No rtpmap for " + codec + " codec");
return sdpDescription;
}
Log.d(TAG, "Found " + codec + " rtpmap " + codecRtpMap + " at " + lines[rtpmapLineIndex]);
// Check if a=fmtp string already exist in remote SDP for this codec and
// update it with new bitrate parameter.
regex = "^a=fmtp:" + codecRtpMap + " \w+=\d+.*[\r]?$";
codecPattern = Pattern.compile(regex);
for (int i = 0; i < lines.length; i++) {
Matcher codecMatcher = codecPattern.matcher(lines[i]);
if (codecMatcher.matches()) {
Log.d(TAG, "Found " + codec + " " + lines[i]);
if (isVideoCodec) {
lines[i] += "; " + VIDEO_CODEC_PARAM_START_BITRATE + "=" + bitrateKbps;
lines[i] += "; " + VIDEO_CODEC_PARAM_MIN_BITRATE + "=" + videoMinBitrateKbps;
lines[i] += "; " + VIDEO_CODEC_PARAM_MAX_BITRATE + "=" + videoMaxBitrateKbps;
} else {
lines[i] += "; " + AUDIO_CODEC_PARAM_BITRATE + "=" + (bitrateKbps * 1000);
}
Log.d(TAG, "Update remote SDP line: " + lines[i]);
sdpFormatUpdated = true;
break;
}
}
StringBuilder newSdpDescription = new StringBuilder();
for (int i = 0; i < lines.length; i++) {
newSdpDescription.append(lines[i]).append("\r\n");
// Append new a=fmtp line if no such line exist for a codec.
if (!sdpFormatUpdated && i == rtpmapLineIndex) {
String bitrateSet;
if (isVideoCodec) {
bitrateSet = "a=fmtp:" + codecRtpMap + " " + VIDEO_CODEC_PARAM_START_BITRATE + "=" + bitrateKbps;
bitrateSet += "; " + VIDEO_CODEC_PARAM_MIN_BITRATE + "=" + videoMinBitrateKbps;
bitrateSet += "; " + VIDEO_CODEC_PARAM_MAX_BITRATE + "=" + videoMaxBitrateKbps;
} else {
bitrateSet = "a=fmtp:" + codecRtpMap + " " + AUDIO_CODEC_PARAM_BITRATE + "=" + (bitrateKbps * 1000);
}
Log.d(TAG, "Add remote SDP line: " + bitrateSet);
newSdpDescription.append(bitrateSet).append("\r\n");
}
}
return newSdpDescription.toString();
}

setStartBitrate(VIDEO_CODEC_H264, true, sdpDic, videoStartBitrateKbps);`

@dahuahuahua
Copy link

请问一下是什么参数设置视频质量呀?实在是没找到

@NightMoonCat
Copy link

请问一下是什么参数设置视频质量呀?实在是没找到

所以,你找到设置视频质量的方法了么? 能否分享下

@dahuahuahua
Copy link

请问一下是什么参数设置视频质量呀?实在是没找到

所以,你找到设置视频质量的方法了么? 能否分享下

没有找到

@SinLT
Copy link

SinLT commented Oct 14, 2022

请问一下是什么参数设置视频质量呀?

所以,你找到设置方法了么?

没有找到

public static final String VIDEO_CODEC_PARAM_START_BITRATE = "x-google-start-bitrate";
public static final String VIDEO_CODEC_PARAM_MAX_BITRATE = "x-google-max-bitrate";
public static final String VIDEO_CODEC_PARAM_MIN_BITRATE = "x-google-min-bitrate";
public static final int videoMaxBitrateKbps = 8000;
public static final int videoMinBitrateKbps = 8000;
public static final int videoStartBitrateKbps = 8000;

@dahuahuahua
Copy link

请问一下是什么参数设置视频质量呀?

所以,你找到设置方法了么?

没有找到

public static final String VIDEO_CODEC_PARAM_START_BITRATE = "x-google-start-bitrate"; public static final String VIDEO_CODEC_PARAM_MAX_BITRATE = "x-google-max-bitrate"; public static final String VIDEO_CODEC_PARAM_MIN_BITRATE = "x-google-min-bitrate"; public static final int videoMaxBitrateKbps = 8000; public static final int videoMinBitrateKbps = 8000; public static final int videoStartBitrateKbps = 8000;

大佬您好,我是用的是"branch_nodejs"分支代码,请问您这些配置是加在PeerConnectionHelper类里面吗?

@SinLT
Copy link

SinLT commented Oct 14, 2022

请问一下是什么参数设置视频质量呀?

所以,你找到设置方法了么?

没有找到

公共静态最终字符串 VIDEO_CODEC_PARAM_START_BITRATE = "x-google-start-bitrate"; 公共静态最终字符串 VIDEO_CODEC_PARAM_MAX_BITRATE = "x-google-max-bitrate"; 公共静态最终字符串 VIDEO_CODEC_PARAM_MIN_BITRATE = "x-google-min-bitrate"; 公共静态最终 int videoMaxBitrateKbps = 8000; 公共静态最终 int videoMinBitrateKbps = 8000; 公共静态最终 int videoStartBitrateKbps = 8000;

大佬你好,我用的是“branch_nodejs”分支代码,请问你这些配置是加在PeerConnectionHelper类里面吗?

是啊
1665728742927

@dahuahuahua
Copy link

请问一下是什么参数设置视频质量呀?

所以,你找到设置方法了么?

没有找到

公共静态最终字符串 VIDEO_CODEC_PARAM_START_BITRATE = "x-google-start-bitrate"; 公共静态最终字符串 VIDEO_CODEC_PARAM_MAX_BITRATE = "x-google-max-bitrate"; 公共静态最终字符串 VIDEO_CODEC_PARAM_MIN_BITRATE = "x-google-min-bitrate"; 公共静态最终 int videoMaxBitrateKbps = 8000; 公共静态最终 int videoMinBitrateKbps = 8000; 公共静态最终 int videoStartBitrateKbps = 8000;

大佬你好,我用的是“branch_nodejs”分支代码,请问你这些配置是加在PeerConnectionHelper类里面吗?

是啊 1665728742927

感谢大佬,比之前清晰了。能否加您个联系方式呢,我Q2920501612

@kanfRUI
Copy link

kanfRUI commented Aug 14, 2023

在最新版中,找不到这个PeerConnectionHelper了,然后复制setStartBitrate方法放到RTCPeer中,好多报错;要怎样解决?大佬

@wang6793453
Copy link

大佬,新版本怎么调高远程视频质量呀?

@wang6793453
Copy link

在最新版中,找不到这个PeerConnectionHelper了,然后复制setStartBitrate方法放到RTCPeer中,好多报错;要怎样解决?大佬

找到解决方法了吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants