Android的拍摄慢动作视频 [英] Android capturing slow motion video

查看:1829
本文介绍了Android的拍摄慢动作视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何能捕捉慢动作视频在我的应用程序?

How can i capture slow motion video in my app?

我试图用

 mMediaRecorder.setVideoFrameRate(100);

但应用程序崩溃,如果我设置的值20以上的有 IllegalStateException异常

我已经研究一个lot.Normal视频是24和30之间fps.To看慢动作视频中,我们需要捕获100-120 FPS,但设备不允许that.But我看到了默认的摄像头在我的设备有一个选项在游戏商店慢motion.Also几个应用程序允许创建慢动作videos.I也尝试设置更高的 setCaptureRate(),但也正常模式下视频captured.At一些地方也提到,慢动作短片可通过的OpenCV / JavaCV 库来实现,但我不明白如何使用这些库中的机器人拍摄慢动作视频?

I have researched a lot.Normal video is between 24 and 30 fps.To see slow motion video we need to capture 100-120 fps but device does not allow that.But I see the default camera in my device has an option of Slow motion.Also few apps in play store allow to create slow motion videos.I also tried setting higher setCaptureRate(),but with that also normal mode video is captured.At few places it is mentioned that slow motion movie can be accomplished through OpenCV/JavaCV libraries but i failed to understand how to use these libraries to capture slow motion video in android?

推荐答案

从源头您所提供(CamcorderProfile),所有你需要做的就是每秒增拍摄的图像:

From the source you provided (CamcorderProfile), all you have to do is INCREASE taken images per second:

mMediaRecorder.setVideoFrameRate(QUALITY_HIGH_SPEED_LOW);

mMediaRecorder.setVideoFrameRate(QUALITY_HIGH_SPEED_HIGH);

所以,如果你把一个每秒100幅图像,并显示每秒25帧,所记录第二个需要4秒钟,表明

请阅读您使用的是类的文档:

公共静态最终诠释QUALITY_HIGH_SPEED_LOW

public static final int QUALITY_HIGH_SPEED_LOW

高速(> = 100FPS)的质量水平。

High speed ( >= 100fps) quality level corresponding to the lowest available resolution.

对于所有下面定义的高速型材((从QUALITY_HIGH_SPEED_LOW到QUALITY_HIGH_SPEED_2160P),它们是相似的正常录像配置文件,只有更高的输出帧速率和比特率。因此,不指定任何设置与setProfile(CamcorderProfile这些配置文件)其他的编码参数会产生高速的视频,而不是慢镜头的影片,有不同的捕捉和输出(回放)的帧速率。要记录慢动作视频,应用程序必须适当地通过setVideoFrameRate设置视频输出(播放),帧速率和比特率(INT )和setVideoEncodingBitRate(INT)的基础上慢动作的因素。如果应用程序打算做视频录制媒体codeC连接codeR,它必须按照本CamcorderProfile同样设置MediaFormat的每个领域。

For all the high speed profiles defined below ((from QUALITY_HIGH_SPEED_LOW to QUALITY_HIGH_SPEED_2160P), they are similar as normal recording profiles, with just higher output frame rate and bit rate. Therefore, setting these profiles with setProfile(CamcorderProfile) without specifying any other encoding parameters will produce high speed videos rather than slow motion videos that have different capture and output (playback) frame rates. To record slow motion videos, the application must set video output (playback) frame rate and bit rate appropriately via setVideoFrameRate(int) and setVideoEncodingBitRate(int) based on the slow motion factor. If the application intends to do the video recording with MediaCodec encoder, it must set each individual field of MediaFormat similarly according to this CamcorderProfile.

这篇关于Android的拍摄慢动作视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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