视频录制框架LandscapeVideoCamera
来源:互联网 发布:网络摄像头的编码器 编辑:程序博客网 时间:2024/06/05 10:26
LandscapeVideoCamera
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:
- 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
. - The default intent does not return the URI of the recorded file if it was specified when launching the intent.
- 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:
repositories { maven { url "https://jitpack.io" } }
2) Add a dependency on the library:
compile 'com.github.JeroenMols:LandscapeVideoCamera:1.2.2'
3) Specify the VideoCaptureActivity in your manifest:
<activity android:name="com.jmolsmobile.landscapevideocapture.VideoCaptureActivity" android:screenOrientation="sensor" > </activity>
4) Request the following permissions in your manifest:
<uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
5) Create a CaptureConfiguration - object with the desired parameters. (optional)
CaptureConfiguration configuration = CaptureConfiguration(CaptureResolution resolution, CaptureQuality quality); CaptureConfiguration configuration = CaptureConfiguration(CaptureResolution resolution, CaptureQuality quality, int maxDurationSecs, int maxFilesizeMb); CaptureConfiguration configuration = CaptureConfiguration(int videoWidth, int videoHeight, int bitrate); CaptureConfiguration configuration = CaptureConfiguration(int videoWidth, int videoHeight, int bitrate, int maxDurationSecs, int maxFilesizeMb); CaptureConfiguration configuration = CaptureConfiguration(int videoWidth, int videoHeight, int bitrate, int maxDurationSecs, int maxFilesizeMb, boolean showTimer); CaptureConfiguration configuration = CaptureConfiguration(int videoWidth, int videoHeight, int bitrate, int maxDurationSecs, int maxFilesizeMb, boolean showTimer, boolean allowFrontCamera);
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
.
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
Thanks
- 视频录制框架LandscapeVideoCamera
- Android录制视频---LandscapeVideoCamera的使用详情及修改
- LandscapeVideoCamera——强大的自定义Android视频类库
- 录制视频
- 视频录制
- 视频录制
- 视频录制
- 录制视频
- 录制视频
- 录制视频
- 视频录制
- 视频录制
- 录制视频
- 录制视频
- 录制视频
- iOS 视频录制、播放,使用视听媒体框架AVFoundation实现视频录制播放 —— HERO博客
- android视频录制(调用系统视频录制)
- 视频录制压力,正反面录制视频
- 压力测试工具siege的用法
- Java项目之画图板(二)
- docker 下useful 命令
- ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy
- http://blog.csdn.net/u010730126/article/details/51082068
- 视频录制框架LandscapeVideoCamera
- 从 Windows 过度到 Mac 必备快捷键对照表(IntelliJ IDEA)
- matlab 安装jdbc.jar
- Java程序员实现月薪2万需要具备哪些技能?
- 使用ssh建立隧道通信
- Swagger介绍-一套流行的API框架
- 关于build方法数超过 64K 的应用的问题
- MySQL配置文件详解
- SpringBoot学习笔记(四) 日志系统