Dana
2025-12-02 3fdb7d3b7e7b1280e70c02305938be963ba56112
app/src/main/java/com/anyun/h264/H264EncodeService.java
@@ -317,9 +317,17 @@
            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);