TeamMaestro / capacitor-video-recorder

Video recorder plugin for Capacitor
59 stars 31 forks source link

Setting up quality of the video #32

Open DanaStefanoska opened 3 years ago

DanaStefanoska commented 3 years ago

Firstly, thanks for this amazing plugin! It would be way better if we can get some kind of documentation.

However, here is a question I have, is there a way to set the quality of which the recording is taken? Thanks!

mcarnoky001 commented 3 years ago

Hey, I was digging in code and found a non documented possibility to adjust video quality.

async openCamera() { await VideoRecorder.initialize({ camera: VideoRecorderCamera.FRONT, // Can use BACK previewFrames: [config], quality: 1 //Here I can setup a video quality }).then(() => { this.setState({ showUI: true }); }); }

This is a code in swift which is setting your video quality by your quality option number. // Set Video quality switch(self.quality){ case 1: self.captureSession?.sessionPreset = AVCaptureSession.Preset.hd1280x720 break; case 2: self.captureSession?.sessionPreset = AVCaptureSession.Preset.hd1920x1080 break; case 3: self.captureSession?.sessionPreset = AVCaptureSession.Preset.hd4K3840x2160 break; case 4: self.captureSession?.sessionPreset = AVCaptureSession.Preset.high break; case 5: self.captureSession?.sessionPreset = AVCaptureSession.Preset.low break; case 6: self.captureSession?.sessionPreset = AVCaptureSession.Preset.cif352x288 break; default: self.captureSession?.sessionPreset = AVCaptureSession.Preset.vga640x480 break; }

DanaStefanoska commented 3 years ago

Thanks @mcarnoky001, I looked in the code and found kind of the same thing. I wanted an official answer for this so if I can setup different values like bitrate also. I managed to set the quality on the video to VGA but it still was a very large file for me, so I also found the setup for bitrate in the code and set that to 128000 which significantly lowered the size of the video. That was fine for me at the moment, but all of my changes now live in the plugins xcode files.

I just wanted to leave this here so if anyone else has the same issue they can find this comments. However I think this should be stated in the documentation also.

maxcodefaster commented 2 years ago

Thanks @mcarnoky001, I looked in the code and found kind of the same thing. I wanted an official answer for this so if I can setup different values like bitrate also. I managed to set the quality on the video to VGA but it still was a very large file for me, so I also found the setup for bitrate in the code and set that to 128000 which significantly lowered the size of the video. That was fine for me at the moment, but all of my changes now live in the plugins xcode files.

I just wanted to leave this here so if anyone else has the same issue they can find this comments. However I think this should be stated in the documentation also.

Where did you set the bitrate?