Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JeroenMols/LandscapeVideoCamera
Powerful custom Android Camera with granular control over the video quality and filesize, restricting recordings to landscape only.
https://github.com/JeroenMols/LandscapeVideoCamera
Last synced: 4 months ago
JSON representation
Powerful custom Android Camera with granular control over the video quality and filesize, restricting recordings to landscape only.
- Host: GitHub
- URL: https://github.com/JeroenMols/LandscapeVideoCamera
- Owner: JeroenMols
- License: apache-2.0
- Created: 2014-01-04T22:00:19.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2020-05-28T14:16:45.000Z (about 4 years ago)
- Last Synced: 2024-03-05T22:22:03.939Z (4 months ago)
- Language: Java
- Homepage:
- Size: 59.7 MB
- Stars: 1,228
- Watchers: 59
- Forks: 294
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-android-libraries - Landscape video camera - 2.0) (Camera)
- awesome-stars - JeroenMols/LandscapeVideoCamera - Powerful custom Android Camera with granular control over the video quality and filesize, restricting recordings to landscape only. (Java)
- awesome-stars - LandscapeVideoCamera - Powerful custom Android Camera with granular control over the video quality and filesize, restricting recordings to landscape only. (Java)
README
LandscapeVideoCamera
=====================
[![Build Status][build-status-svg]][build-status-link]
[![Codecov.io][coverage-svg]][coverage-link]
[![Release][jitpack-svg]][jitpack-link]
[![MethodCount][methodcount-svg]][methodcount-link]
[![License][license-svg]][license-link]Highly flexible Android Camera which offers granular control over the video quality and filesize, while restricting recordings to be landscape only.
There are a number of issues with the default Android intent to capture videos (`MediaStore.ACTION_VIDEO_CAPTURE`) which led me to create this library project:
1. The default intent only accepts integer quality parameters of 0 (MMS quality) or 1 (highest available quality), using the intent extra `MediaStore.EXTRA_VIDEO_QUALITY`.
2. The default intent does not return the URI of the recorded file if it was specified when launching the intent.
3. The default intent doesn't care whether users capture their video in portrait mode or landscape.
## Features
This library provides a full and reusable custom camera, which:
* Forces the users to rotate their device to landscape
* Allows to specify the filename, or have the library generate one for you
* Allows very granular control over the capture settings:
* Resolution
* Bitrate
* Max filesize
* Max video duration
* audio/video codec
* switch between front and rear facing camera
* ...## How to use
1) Add the Jitpack repository to your project:
```groovy
repositories {
maven { url "https://jitpack.io" }
}
```
2) Add a dependency on the library:
```groovy
compile 'com.github.jeroenmols:LandscapeVideoCamera:1.3.0'
```
3) Specify the VideoCaptureActivity in your manifest:
```xml
```
4) Request the following permissions in your manifest:
```xml
```
5) Create a CaptureConfiguration using the Builder
```java
// Choose one of both
CaptureConfiguration.Builder builder = new CaptureConfiguration.Builder(CaptureResolution resolution, CaptureQuality quality);
CaptureConfiguration.Builder builder = new CaptureConfiguration.Builder(int videoWidth, int videoHeight, int bitrate);// Optional
builder.maxDuration(maxDurationSec);
builder.maxFileSize(maxFileSizeMb);
builder.frameRate(framesPerSec);
builder.showRecordingTime(); // Show the elapsed recording time
builder.noCameraToggle(); // Remove button to toggle between front and back camera// Get the CaptureConfiguration
CaptureConfiguration configuration = builder.build();
```
Note: When no CaptureConfiguration is specified, a default configuration will be used.Note 2: Subclass the CaptureConfiguration class to set more advanced configurations. (codecs, audio bitrate,...)
6) Launch the `VideoCaptureActivity` for result, add the CaptureConfiguration as an parcelable extra `EXTRA_CAPTURE_CONFIGURATION` and optionally add a String extra `EXTRA_OUTPUT_FILENAME`.
```java
final Intent intent = new Intent(getActivity(), VideoCaptureActivity.class);
intent.putExtra(VideoCaptureActivity.EXTRA_CAPTURE_CONFIGURATION, config);
intent.putExtra(VideoCaptureActivity.EXTRA_OUTPUT_FILENAME, filename);
startActivityForResult(intent, RESULT_CODE);
```
7) Check the resultcode (`RESULT_OK`, `RESULT_CANCELLED` or `VideoCaptureActivity.RESULT_ERROR`) and in case of success get the output filename in the intent extra `EXTRA_OUTPUT_FILENAME`.## Questions
[@molsjeroen](https://twitter.com/molsjeroen)## Thanks
[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-LandscapeVideoCamera-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1209)[build-status-svg]: https://travis-ci.org/JeroenMols/LandscapeVideoCamera.svg?branch=master
[build-status-link]: https://travis-ci.org/JeroenMols/LandscapeVideoCamera
[coverage-svg]: https://codecov.io/github/JeroenMols/LandscapeVideoCamera/coverage.svg?branch=master
[coverage-link]: https://codecov.io/github/JeroenMols/LandscapeVideoCamera?branch=master
[jitpack-svg]: https://jitpack.io/v/jeroenmols/landscapevideocamera.svg
[jitpack-link]: https://jitpack.io/#jeroenmols/LandscapeVideoCamera
[methodcount-svg]: https://img.shields.io/badge/Methodscount-299-e91e63.svg
[methodcount-link]: http://www.methodscount.com/?lib=com.github.JeroenMols%3ALandscapeVideoCamera%3A%2B
[license-svg]: https://img.shields.io/:license-apache-blue.svg?style=flat
[license-link]: https://github.com/JeroenMols/LandscapeVideoCamera/blob/master/LICENSE