CameraRecorder-android icon indicating copy to clipboard operation
CameraRecorder-android copied to clipboard

Video rotation help

Open WangYP90 opened this issue 4 years ago • 2 comments

Hello, if I need to rotate the video with an angle to save it as a file when recording on a horizontal screen, what should I do? I look forward to your help.

WangYP90 avatar Apr 07 '20 02:04 WangYP90

下面步骤可以在横屏模式下录制竖屏视频:

  1. GlPreviewRenderer类创建一个新的MMatrix2
private float[] MMatrix2 = new float[16];
Matrix.setIdentityM(MMatrix2, 0);
  1. 修改编码部分代码
        synchronized (this) {
            if (videoEncoder != null) {
                Matrix.multiplyMM(MVPMatrix, 0, VMatrix, 0, MMatrix2, 0);
                Matrix.multiplyMM(MVPMatrix, 0, ProjMatrix, 0, MVPMatrix, 0);

                // notify to capturing thread that the camera frame is available.
                videoEncoder.frameAvailableSoon(texName, STMatrix, MVPMatrix, aspectRatio);
            }
        }
  1. MediaVideoEncoder类的fileWidth和fileHeight互相调换

hellojiawa avatar Mar 02 '21 02:03 hellojiawa

Do you have a working example that you can post or share? I'm trying to do the same thing. Rotate video 90 degrees.

ToysoftInc avatar Jul 25 '21 17:07 ToysoftInc