Open zfan93 opened 5 years ago
`final TextureView textureView=new TextureView(this); setContentView(textureView); videoRecorder=new VideoRecorderImpl(this); videoRecorder.reset(); // videoRecorder.setOutputUri("rtmp://192.168.16.125:1935/live/livestream"); videoRecorder.setOutputUri(Environment.getExternalStorageDirectory().getAbsolutePath()+"/test.mp4"); videoRecorder.setOutputSize(720,1280); videoRecorder.setFps(20); // videoRecorder.setFilter(getDefaultFilter()); videoRecorder.setPreviewDisplay(textureView); // videoRecorder.enableHardware(true); videoRecorder.setOnStateListener(new VideoRecorder.OnStateListener() { @Override public void onStop() {
} @Override public void onError(int i, @NotNull String s) { } @Override public void onPrepared(@NotNull Encoder encoder) { videoRecorder.start(); } @Override public void onRecord(@NotNull Encoder encoder, long l) { } }); videoRecorder.prepare();`
打印日志内容为:
E/MuxerImpl: Add audio track I/MuxerImpl: addAudioTrack 2 E/MuxerImpl: Muxer audio start V/VideoEncoderImpl: INFO_OUTPUT_FORMAT_CHANGED E/MuxerImpl: Muxer video start I/MPEG4Writer: limits: 4294967295/0 bytes/us, bit rate: -1 bps and the estimated moov size 3195 bytes E/MuxerImpl: Muxer start I/MPEG4Writer: setStartTimestampUs: 113378 I/MPEG4Writer: Earliest track starting time: 113378 I/MPEG4Writer: setStartTimestampUs: 0 I/MPEG4Writer: Earliest track starting time: 0 E/MPEG4Writer: timestampUs 87139 < lastTimestampUs 120661 for Video track
本地生成的mp4文件一直是3.23k的固定大小。请问是否是我使用方法不对?
同样的代码,只要将outputUri更换为网址就不会卡住。
`final TextureView textureView=new TextureView(this); setContentView(textureView); videoRecorder=new VideoRecorderImpl(this); videoRecorder.reset(); // videoRecorder.setOutputUri("rtmp://192.168.16.125:1935/live/livestream"); videoRecorder.setOutputUri(Environment.getExternalStorageDirectory().getAbsolutePath()+"/test.mp4"); videoRecorder.setOutputSize(720,1280); videoRecorder.setFps(20); // videoRecorder.setFilter(getDefaultFilter()); videoRecorder.setPreviewDisplay(textureView); // videoRecorder.enableHardware(true); videoRecorder.setOnStateListener(new VideoRecorder.OnStateListener() { @Override public void onStop() {
打印日志内容为:
E/MuxerImpl: Add audio track I/MuxerImpl: addAudioTrack 2 E/MuxerImpl: Muxer audio start V/VideoEncoderImpl: INFO_OUTPUT_FORMAT_CHANGED E/MuxerImpl: Muxer video start I/MPEG4Writer: limits: 4294967295/0 bytes/us, bit rate: -1 bps and the estimated moov size 3195 bytes E/MuxerImpl: Muxer start I/MPEG4Writer: setStartTimestampUs: 113378 I/MPEG4Writer: Earliest track starting time: 113378 I/MPEG4Writer: setStartTimestampUs: 0 I/MPEG4Writer: Earliest track starting time: 0 E/MPEG4Writer: timestampUs 87139 < lastTimestampUs 120661 for Video track
本地生成的mp4文件一直是3.23k的固定大小。请问是否是我使用方法不对?