Amit Thaper
Amit Thaper

Reputation: 2137

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

Upvotes: 4

Views: 1075

Answers (1)

alexandr.opara
alexandr.opara

Reputation: 454

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.

Upvotes: 0

Related Questions