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

Projects
None yet
3 participants
@andrewschenk-linx
Copy link
Contributor

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);
Added 'targetBitrate' option for Android video recording. targetBitra…
…te takes an integer value (e.g. 1000*1000*5 aka 5Mbps).
@sibelius
Copy link
Member

left a comment

What happens when user does not pass it?

@andrewschenk-linx

This comment has been minimized.

Copy link
Contributor Author

commented Jan 16, 2019

@n1ru4l
Copy link
Member

left a comment

@andrewschenk-linx Could you please add types and documentation

andrewschenk-linx added some commits Jan 17, 2019

Adds documentation for targetBitrate recording option. Adds type for …
…targetBitrate in RNCamera. Adds safety rails for proper usage.
@andrewschenk-linx

This comment has been minimized.

Copy link
Contributor Author

commented Jan 17, 2019

Added documentation and types.

@n1ru4l
Copy link
Member

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 some 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-community:master Jan 18, 2019

1 check passed

ci/circleci Your tests passed on CircleCI!
Details

n1ru4l pushed a commit that referenced this pull request Jan 18, 2019

chore(release): 1.9.0 [skip ci]
# [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

This comment has been minimized.

Copy link
Member

commented Jan 18, 2019

🎉 This PR is included in version 1.9.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@n1ru4l n1ru4l added the released label Jan 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.