同时使用前后摄像头android [英] Using both front and back cameras simultaneously android

查看:102
本文介绍了同时使用前后摄像头android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题之前已经被问过很多次了.一年多前我曾寻找过它,但没有找到任何东西,所以再次发布这个问题以收集是否有任何新的想法/方法或技巧.

I know this question has been asked many times before. I had looked for it over a year ago but didn't find anything so posting this question again to gather if there are any new thoughts/ approaches or hacks.

我希望能够从 Android 设备中的两个摄像头(正面和背面)捕获视频.

I want to be able to capture video from both cameras (front and back) in an android device.

我现在唯一的想法是如何每 0.1 秒在正面和背面之间切换,但是我从未能够对此进行编码.请任何人对此提供帮助.

My only thought as of now is to some how switch between front and back every 0.1 sec, however I have never been able to code this. Any help from anyone on this, please.

另一个想法是 - 视频通常以每秒 15 或 30 帧的速度捕获.假设它是每秒 30 帧.如果有一种方法可以将这些帧前后交替,那么我们可以拥有每秒 15 帧的正面视频和每秒 15 帧的背面视频.这可能吗?如果是,那么如何?请建议.音频会发生什么?也许我们可以将音频限制为仅录制一个视频(正面或背面).

Also another thought is - videos are generally captured at 15 or 30 frames per second. Assume it is at 30 frames per second. What if there is a way to alternate these frames to front and back, then we could have 15 frames per second of front and 15 frames per second of back video. Is this possible? If yes then how? Please suggest. What happens to the audio? Maybe we could restrict audio to only one of the video recordings (front or back).

推荐答案

据我测试,它可以在 HTC m8、OnePlusOne 和 Motorola Nexus 6 上运行.更多的手机可能支持它,但您只需要在手机上进行测试,看看应用程序是否崩溃.

It's possible on the HTC m8, the OnePlusOne and the Motorola Nexus 6, as far as I have tested. Many more phones might support it, but you just have to test on the phones and see if the app crashes or not.

您为每个可用的相机创建一个相机对象,并将每个对象附加到预览回调.

You create a camera object for each available camera and have each attach to the preview callback.

-编辑-到目前为止,我发现这适用于基于 Snapdragon 801 的手机.不知道他们是否都这样做或其他 SOC 支持它,但这是我目前发现的.

-edit- So far I've found that this works on Snapdragon 801 based phones. Dunno if all of them do it or what other SOCs support it, but that's what I've found so far.

这篇关于同时使用前后摄像头android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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