是否有任何方法来实现慢动作和时间间隔记录使用摄像头API?
我试着使用MediaRecorder设置VideoFrameRate,VideoBitRate VideoCaptureRate,但对我来说没有任何效果。
我已经成功地使用JNI实现了,但是我发现它花费了太多的时间,也没有进行优化。
如果您找到任何其他解决方案,请帮助我。
发布于 2016-04-02 10:27:36
我自己解决了这个问题,我分享了我的工作代码,仅仅使用相机API慢动作和时间流逝就实现了。
在开始之前,您必须知道setCaptureRate(double fps)的定义
设置视频帧捕获率。这可以用于设置与录制的视频的回放速率不同的视频帧捕获率。该方法还将记录模式设置为时间间隔。在延时视频记录中,只记录视频。如果应用程序设置与音频相关的参数,则在时间间隔记录会话开始时忽略这些参数。
TimeLapse
对于时间间隔,您需要使用以下相机轮廓,根据您的视频帧的宽度和高度。从下面的轮廓中选择任何一个,或者你可以根据你的需要选择其他的。
profile = CamcorderProfile.get(CamcorderProfile.QUALITY_TIME_LAPSE_1080P);
profile = CamcorderProfile.get(CamcorderProfile.QUALITY_TIME_LAPSE_720P);
profile = CamcorderProfile.get(CamcorderProfile.QUALITY_TIME_LAPSE_480P);现在您需要配置您的视频setCaptureRate和setVideoEncodingBitRate
video_recorder.setCaptureRate(profile.videoFrameRate/6.0f);
video_recorder.setVideoEncodingBitRate(profile.videoBitRate);最后,您需要将配置好的配置文件设置为MediaRecorder。
video_recorder.setProfile(profile);慢速运动
对于慢动作,您还需要配置CamcorderProfile,我正在为配置文件使用以下配置。
profile = CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH_SPEED_HIGH);
video_recorder.setCaptureRate(profile.videoFrameRate / 0.25f);
video_recorder.setVideoEncodingBitRate(profile.videoBitRate);
video_recorder.setProfile(profile);用于慢动作,您必须使用CameraAPI2,否则它将无法工作。
https://stackoverflow.com/questions/36176085
复制相似问题