使用SurfaceView进行视频录制,一切都很好,但视频在录制时左旋90度。
setContentView(R.layout.activity_video_capture);
SurfaceView cameraView = (SurfaceView) findViewById(R.id.videoview);
surfaceHolder = cameraView.getHolder();
surfaceHolder.addCallback(this);
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
答案 0 :(得分:3)
试试这个:
camera = Camera.open(Camera.CameraInfo.CAMERA_FACING_BACK);
camera.setDisplayOrientation(90);
camera.unlock();
mediaRecorder = new MediaRecorder();
mediaRecorder.setCamera(camera);
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
CamcorderProfile camcorderProfile_HQ = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH);
mediaRecorder.setProfile(camcorderProfile_HQ);
mediaRecorder.setOutputFile(getOutputMediaFile(2).toString());
mediaRecorder.setMaxDuration(60000); // Set max duration 60 sec.
mediaRecorder.setMaxFileSize(5000000); // Set max file size 5M