简体   繁体   中英

Android: Crop video while recording using MediaCodec and MediaMuxer

I am trying to record the video using GLSurfaceView and audio from the AudioRecord. In MediaMuxer I am sending both audio and video data when onFrameAvailable called. I set the camera preview size of 1280 * 720 and preview on the full screen. I am having problem to crop the frame to 600 * 600. Can anybody help me to crop the video frame before encoding to MediaCodec and MediaMuxer.

I am taking help from the Grafika android demo code

You need to solve to problems:

  1. Record video with 600 * 600: Use video codec with specified width, height. This is easy to do, but it could be that not all phones have hardware codecs that will supports you custom resolution.
  2. Scale video in the way it will look not stretched because you have changed w/h ratio. Use view matrix passed to OpenGL shader with needed scale.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM