Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(android): add videoBitrate option for recordAsync #2055

Merged
merged 8 commits into from Jan 18, 2019

Conversation

@andrewschenk-linx
Copy link
Contributor

@andrewschenk-linx andrewschenk-linx commented Jan 16, 2019

While VideoQuality can be set, this option does not give developers anyway to fine-tune the resulting file size of a recorded video. 720p recording will use a 12 Mbps bitrate on a Galaxy S8+, even though 720p should be closer to 5 Mbps.

Introducing a new optional recording option helps to solve this problem.
targetBitrate takes an integer value (e.g. 1000 x 1000 x 5 aka 5Mbps).

Example of calling it from React Native

const recordingOptions = {
          maxDuration: 60*20,
          mute: false,
          quality: RNCamera.Constants.VideoQuality['720p'],
          targetBitrate: 1000*1000*5 // 5 Mbps
};
const data = await this.camera.recordAsync(recordingOptions);
…te takes an integer value (e.g. 1000*1000*5 aka 5Mbps).
Copy link
Collaborator

@sibelius sibelius left a comment

What happens when user does not pass it?

@andrewschenk-linx
Copy link
Contributor Author

@andrewschenk-linx andrewschenk-linx commented Jan 16, 2019

Copy link
Collaborator

@n1ru4l n1ru4l left a comment

@andrewschenk-linx Could you please add types and documentation

…targetBitrate in RNCamera. Adds safety rails for proper usage.
@andrewschenk-linx
Copy link
Contributor Author

@andrewschenk-linx andrewschenk-linx commented Jan 17, 2019

Added documentation and types.

Copy link
Collaborator

@n1ru4l n1ru4l left a comment

After thinking about it a bit I think we can name it videoBitrate instead of targetBitrate.

Can you please rename it? I will merge it aftwerwards!

andrewschenk-linx and others added 4 commits Jan 18, 2019
@n1ru4l
n1ru4l approved these changes Jan 18, 2019
@n1ru4l n1ru4l changed the title Added 'targetBitrate' option for Android video recording. feat(android): add videoBitrate option for recordAsync Jan 18, 2019
@n1ru4l n1ru4l merged commit d93a6c7 into react-native-camera:master Jan 18, 2019
1 check passed
1 check passed
ci/circleci Your tests passed on CircleCI!
Details
n1ru4l pushed a commit that referenced this pull request Jan 18, 2019
# [1.9.0](v1.8.1...v1.9.0) (2019-01-18)

### Features

* **android:** add videoBitrate option for recordAsync ([#2055](#2055)) [skip release] ([d93a6c7](d93a6c7))
* allow camera scene when audio permissions are denied ([#2048](#2048)), Fixes [#2047](#2047), Fixes [#2051](#2051) ([22533ed](22533ed))
@n1ru4l
Copy link
Collaborator

@n1ru4l n1ru4l commented Jan 18, 2019

🎉 This PR is included in version 1.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants