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
cannot set bitrate in displayBase to increase the video quality #1377
Comments
Hello, Video resolution is set using width and height parameters so I Think that you mean video quality. In this case Display is a bit special because you need set dpi parameter depend of your screen device. You can get max dpi of your screen using this method: getResources().getDisplayMetrics().densityDpi This should give you the max dpi for your device and this will increase the quality. You can read more about it in this post: |
I have try something like this : fun prepareStreamRtp(endpoint: String, resultCode: Int, data: Intent,video_config_map: HashMap<String, Any>) {
keepAliveTrick()
stopStream()
if (endpoint.startsWith("rtmp")) {
displayBase = RtmpDisplay(baseContext, true, connectChecker)
// displayBase?.setVideoBitrateOnFly(1920*1080*30)
displayBase?.setIntentResult(resultCode, data)
} else {
displayBase = RtspDisplay(baseContext, true, connectChecker)
displayBase?.setIntentResult(resultCode, data)
}
val width:Double = video_config_map["width"] as Double
val height:Double = video_config_map["height"] as Double
displayBase?.glInterface?.setForceRender(true)
var maxdpi=getResources().getDisplayMetrics().densityDpi
// displayBase?.prepareVideo(width.toInt(), height.toInt(), video_config_map["fps"]!! as Int, video_config_map["bitrate"]!! as Int, 0, 320)
displayBase?.prepareVideo(width.toInt(), height.toInt(), 30,186624000, 0,maxdpi)
}
@RequiresApi(api = 29)
fun startStreamRtp(endpoint: String) {
if (displayBase?.isStreaming != true) {
// if (displayBase?.prepareVideo() == true && displayBase?.prepareAudio() == true) {
// displayBase?.startStream(endpoint)
// }
if (displayBase?.prepareVideo() == true && displayBase?.prepareInternalAudio() == true) {
val bitrate = displayBase?.bitrate
Log.i("mytag", "bitrate = $bitrate")
val resolutionValue = displayBase?.resolutionValue
Log.i("mytag", "resolutionValue = $resolutionValue")
displayBase?.startStream(endpoint)
}
} else {
showNotification("You are already streaming :(")
}
} But Unfortunately, the quality and resolution of the video is still poor |
Hello, I'm not sure the way you are using the methods but you have 2 prepareVideo methods so you should use the same configuration in both cases. if (displayBase?.prepareVideo() == true && displayBase?.prepareInternalAudio() == true) {
prepareVideo without parameters is like use this: So you should use parameters like in the first case that you use prepareVideo |
Thank you so much for your help. I have a much better video quality now. |
Hello I am trying to work on the screen mirroring following the display example in demo.But I found that the resolution is quite poor when it displays the data in the rtmp player. I have tried to setBitrate by using the prepareVideo function in the displayBase.But I just found that the bitrate cannot be changed.
Here is my error log:
my prepare function for reference:
and the rest of the code should the same as the example
the VideoEncoder has used default bitrate since my inputed bitrate is not supported by CBR.But I have already tried different bitrate like 800000, 500000, or even the default one 1200*1024, all of them has the same error.So I am wondering what is the correct bitrate I should tried to increase my video resolution
The text was updated successfully, but these errors were encountered: