|
|
|
@ -173,12 +173,12 @@ public class MediaCodecManager {
|
|
|
|
|
int videoH = rotation == 90 || rotation == 270 ? dstWidth : dstHeight;
|
|
|
|
|
mediaFormat = MediaFormat.createVideoFormat(MIME_TYPE,//注意这里旋转后有一个大坑,就是要交换mHeight,和mWidth的位置。否则录制出来的视频时花屏的。
|
|
|
|
|
videoW, videoH);
|
|
|
|
|
int frameRate = 24; // 15fps
|
|
|
|
|
int frameRate = 17; // 15fps
|
|
|
|
|
int compressRatio = 256;
|
|
|
|
|
int bitRate = dstWidth * dstHeight * 3 * 8 * frameRate / compressRatio;
|
|
|
|
|
|
|
|
|
|
mediaFormat.setInteger(MediaFormat.KEY_BIT_RATE, bitRate);
|
|
|
|
|
mediaFormat.setInteger(MediaFormat.KEY_FRAME_RATE, (int) (frameRate * 0.3));
|
|
|
|
|
mediaFormat.setInteger(MediaFormat.KEY_FRAME_RATE, frameRate);
|
|
|
|
|
mediaFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, mColorFormat);
|
|
|
|
|
mediaFormat.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL, 3);
|
|
|
|
|
LogUtils.w("prepare format: " + mediaFormat);
|
|
|
|
|