How to change MediaCodec encoding bitrate on the fly while streaming in Android?

半腔热情 提交于 2019-12-01 10:38:10

Stopping the Codec, setting the parameters and restarting it worked for me.

Your format needs to support adaptive bitrate. Eg. I was able to set the bitrate using the following. Make sure you're in api 19 or above though.I was encoding the H264 frames into an FLV container.

Bundle bitrate = new Bundle(); bitrate.putInt(MediaCodec.PARAMETER_KEY_VIDEO_BITRATE, targetBitrate); mEncoder.setParameters(bitrate);

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!