Muxing camera preview h264 encoded elementary stream with MediaMuxer

后端 未结 2 717
有刺的猬
有刺的猬 2021-01-05 14:17

I am working on an implementation of one of the Android Test Cases regarding previewTexture recording with the new MediaCodec and MediaMuxer API\'s of Android 4.3.

I

相关标签:
2条回答
  • 2021-01-05 15:02

    I suspect you're getting bitten by the MediaMuxer disk write. The best way to be sure is to run systrace during recording and see what's actually happening during the pause. (systrace docs, explanation, bigflake example -- as of right now only the latter is updated for Android 4.3)

    If that's the case, you may be able to mitigate the problem by running the MediaMuxer instance on a separate thread, feeding the H.264 data to it through a synchronized queue.

    Do these pauses happen regularly, every 5 seconds? The CameraToMpegTest example configures the encoder to output an I-frame every 5 seconds (with an expected frame rate of 30fps), which results in a full-sized frame being output rather than tiny deltas.

    0 讨论(0)
  • 2021-01-05 15:09

    As @fadden points out, this is a disk write issue that occurs mostly on devices with lower writing flash speeds or if you try to write to the SD card.

    I have written a solution on how to buffer MediaMuxer's write in a similar question here.

    0 讨论(0)
提交回复
热议问题