| | |
| | | int height = DEFAULT_HEIGHT; |
| | | int framerate = DEFAULT_FRAME_RATE; |
| | | h264Encoder.setEncoderParams(width, height, framerate, DEFAULT_BITRATE); |
| | | |
| | | // 禁用文件输出 |
| | | h264Encoder.setEnableFileOutput(false); |
| | | |
| | | long timeFile = System.currentTimeMillis(); |
| | | SimpleDateFormat bcdFormat = new SimpleDateFormat("yyMMddHHmmss"); |
| | | String str = bcdFormat.format(timeFile); |
| | | Timber.i("startNetworkEncode 文件名:%s", str); |
| | | // 设置输出文件 |
| | | String fileName = "h264_" + timeFile+ ".h264"; |
| | | File outputFile = new File(outputFileDirectory, fileName); |
| | | h264Encoder.setOutputFile(outputFile.getAbsolutePath()); |
| | | h264Encoder.setEnableFileOutput(true); // 启用文件输出 |
| | | |
| | | |
| | | // 启用网络传输并设置服务器地址 |
| | | h264Encoder.setEnableNetworkTransmission(true); |