Skip to content
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.

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

Merged
merged 8 commits into from Jan 18, 2019

Conversation

andrew-schenk
Copy link
Contributor

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when user does not pass it?

@andrew-schenk
Copy link
Contributor Author

andrew-schenk commented Jan 16, 2019 via email

Copy link
Collaborator

@n1ru4l n1ru4l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrewschenk-linx Could you please add types and documentation

@andrew-schenk
Copy link
Contributor Author

Added documentation and types.

Copy link
Collaborator

@n1ru4l n1ru4l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@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
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 commented Jan 18, 2019

:tada: This PR is included in version 1.9.0 :tada:

The release is available on:

Your semantic-release bot 📦🚀

sunil-dev7 added a commit to sunil-dev7/react-native-camera that referenced this pull request Jun 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants