Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

保存为本地mp4文件的情况下,大约1秒以后画面卡住。 #11

Open
zfan93 opened this issue Feb 1, 2019 · 1 comment
Open

Comments

@zfan93
Copy link

zfan93 commented Feb 1, 2019

`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的固定大小。请问是否是我使用方法不对?

@zfan93
Copy link
Author

zfan93 commented Feb 1, 2019

同样的代码,只要将outputUri更换为网址就不会卡住。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant