如何以编程方式在Android上记录高速视频(60-120fps) [英] How to programmatically record high speed videos (60-120fps) on android

查看:1656
本文介绍了如何以编程方式在Android上记录高速视频(60-120fps)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一段代码,可以使用Android相机使用MediaRecorder和相机api 1在QUALITY_HIGH上录制视频。

I have a piece of code that can use the android camera to record videos at QUALITY_HIGH using MediaRecorder and the camera api 1.

相机代码基于: https://github.com/Glamdring/EasyCamera

视频录制可能类似于:如何在三星设备android上记录特定宽度和高度的视频?

And the video recording might resemble this: How to record video of particular width and height on samsung device android?

我可以从文档中看到 http://developer.android.com/intl/es/reference/android/media /CamcorderProfile.html#QUALITY_HIGH_SPEED_HIGH 有高速视频的个人资料,但... ...调用:

I can see from the documentation http://developer.android.com/intl/es/reference/android/media/CamcorderProfile.html#QUALITY_HIGH_SPEED_HIGH that there's a profile for high speed video but... calling this:

 CamcorderProfile profile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH_SPEED_LOW);

引发异常:


E / MediaProfiles:给定摄像机配置文件摄像头0质量2000是
未找到

"E/MediaProfiles: The given camcorder profile camera 0 quality 2000 is not found"

调用:

 mMediaRecorder.setVideoFrameRate(100);

运行,但输出视频不是100fps。

runs but the output video is not 100fps.

并呼叫:

 mMediaRecorder.setVideoFrameRate(CamcorderProfile.QUALITY_HIGH_SPEED_LOW);

引发异常:


MediaRecorder:setVideoFrameRate失败:-22

MediaRecorder: setVideoFrameRate failed: -22

我可以使用内置相机应用程序录制慢动作视频这将产生一个mp4在120fps,所以我很确定该设备可以记录高速视频,但似乎丢失了一些。

I can use the built in camera application to record a "slow motion video" which will produce an mp4 at 120fps so I am pretty sure that the device can record a high speed video but something seems missing.

推荐答案

p>首先,请使用检查相机设备支持的fps范围getSupportedPreviewFpsRange

我也对智能手机内置的相机应用程序进行了测试,支持慢动作,并且可以以高帧速率(120fps)录制。但是根据 getSupportedPreviewFpsRange 的结果,帧速率不超过30fps。

I also did a test on a smartphone built-in camera app that supports slow motion and can indeed record at high frame rate (120fps). But from the results of getSupportedPreviewFpsRange, the frame rate is no more than 30fps.

我认为供应商不最初提供了以高帧率录制的接口,虽然内置摄像头应用程序显示其硬件能力这样做。我想这是因为如果不正确使用可能会导致意外的结果,如硬件损坏。

I think the vendor does not originally provide the interface to record at high frame rate although the built-in camera app shows its hardware ability to do so. I guess this is because it may cause unexpected results such as hardware damage if it is not used properly.

录制高速视频的硬件要求高于录制常规视频。内置相机应用程序可能对慢动作视频使用不同的录制策略。例如,它可以使用较低的分辨率和对光的不同响应。

The hardware requirement of recording high speed videos is higher than that of recording conventional videos. The built-in camera app may use a different recording strategy for slow motion videos. For example, it may use a lower resolution and different responses to light. Thus the access to programmatically recording high speed videos is not exposed.

但是,在这里,它利用了新的camera2 API。你需要root,它可能不稳定。

However, there is a hack solution in here which utilizes the new camera2 API. You need root and it may not be stable.

这篇关于如何以编程方式在Android上记录高速视频(60-120fps)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆