Android相机本机访问:startPreview()vs startRecording() [英] Android camera native access : startPreview() vs startRecording()

查看:576
本文介绍了Android相机本机访问:startPreview()vs startRecording()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用Android ICS中的本机代码工作:
大多数手册参考 startPreview()方法。但是浏览AOSP代码我还在< Camera.h> 中找到了 startRecording() 这里说,它是从接口ICameraRecordingProxy
,允许录音机接收

Trying to get camera working from native code in Android ICS: most manuals refer to startPreview() method . But browsing AOSP code I've found also 'startRecording()' method in <Camera.h>. Here said that it is from interface ICameraRecordingProxy "that allows the recorder to receive video frames during recording"

所以问题是 - 在性能方面是'startRecording'方法比'startPreview'更有效率吗?

So the question is - in terms of performance is 'startRecording' approach more efficient than 'startPreview'?

进入本地代码的唯一目标是performace,Java'Camera'太慢,OpenCV也不提供所需的FPS级别。

The only one goal of going into native code is performace, Java 'Camera' is too slow, and OpenCV does not provide required level of FPS as well..

EDIT:目标平台是:API level = 17,设备Allwinner A31开发板,1280x720x30FPS。
任务是从相机捕获帧,修改它们,编码(H264)并存储到SD卡。
纯java MediaRecorder用1280x720x30写mp4文件。

target platform is: API level=17, device Allwinner A31 development board, 1280x720x30FPS. The task is to capture frames from camera, modify them, encode (H264) and store to SD card. pure java MediaRecorder write mp4 file with 1280x720x30. Show live preview on screen is not needed.

OpenCV-demo1在纯模式下提供1920x1080x2(与java模式相同)。简单的java方法与空的PreviewCallback最大FPS为15.

OpenCV-demo1 in native mode gives 1920x1080x2 (same in java mode). Simple java approach with empty PreviewCallback maximal FPS is 15.

提前谢谢。

推荐答案

关闭主题:
我使用本机访问摄像头并使用硬件H264编码器,能够使用FPS = 30达到1280x720。也可以修改(水印)数据在飞行保持FPS高。
没有其他方法 - 任何JAVA或OpenCV可以提供更多的15 FPS(可能是我没有努力..)

to close topic: I was able to reach 1280x720 with FPS=30 using native access to camera and use hardware H264 encoder. Also can modify (watermark) data on the fly keeping FPS high. None of other approaches - any JAVA or OpenCV could give more that 15 FPS (may be I did not try hard..)

startRecording

startRecording() works perfectly

感谢您的意见

这篇关于Android相机本机访问:startPreview()vs startRecording()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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