本文介绍了如何使用 Unity 使用 ARCore 录制视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经被这个问题困扰了一个多月了.我只需要在人们使用 AR 应用时录制视频源.

I have been stuck on this problem for over a month now. I just need to record the video feed when people are using the AR app.

有几个选项:

1.在 Unity 中为每一帧截图.
我尝试了 每帧截图.这太慢了.fps 仅为 5.
然后我尝试保存纹理到一个数组,然后将它们编码为图像.
这会占用大量内存,并且会导致手机出现明显的掉帧.fps在10左右.
如果有人对此方法有什么好主意,请告诉我.

1. Take the screenshot in Unity for every frame.
I tried taking a screenshot every frame. This is way too slow. The fps is only 5.
Then I tried saving the texture to an array and encode them to images afterwards.
This would take a lot of memory and would cause a significant frame drop on mobile phone. The fps is around 10.
If anyone has a great idea for this method, please let me know.

2.使用原生插件录制视频.
我还没有找到任何解决方案.恐怕这可能会与 ARCore 发生冲突.

2. Use native plugins to record video.
I haven't found any solutions on this one. I am afraid that this may conflict with the ARCore.

我知道有一个 Android 解决方案,但理想情况下我想使用统一.感谢您的帮助,谢谢!

I know that there is an Android solution but ideally I want to use Unity. Any help is appreciated, thank you!

3.从 ARCore 计算机视觉示例提供的纹理读取器 api 中保存纹理.
目录中有一个计算机视觉示例.而且我可以通过它的 api 直接从 GPU 获取纹理.

3. Save the texture from the texture reader api provided by ARCore computer vision example.
There is a Computer Vision example in the directory. And I can get the texture directly from GPU with its api.

然而,fps仍然很低.对于边缘检测器示例,fps 大约为 15.我成功地将这些帧保存到另一个线程的本地目录中.但是fps仍然不可接受.底线是 720p 30fps.

However, the fps is still low. With its edge detector example, the fps is around 15. I succeeded in saving those frames to local directory in another thread. But the fps is still not acceptable. The bottomline is 720p at 30fps.

PS:我只需要保存帧.我可以将它们编码成视频.

PS: I just need to save the frames. I can handle encoding them into videos.

PPS:只记录摄像机输入同时记录摄像机输入和增强对象都可以.任何一个成就都很棒.

PPS: Just recording the camera feed and recording the camera feed and the augmented objects together are both okay. Either one achieved is great.

推荐答案

您可以使用(非常棒的)NatCorder 统一资产 (资产商店链接)和相关的NatShare API.我在自己的 ARCore 实验/游戏".

You can easily implement video recording AND sharing using the (really great) NatCorder unity asset (asset store link) and the related NatShare API. I did this very same thing in my own ARCore experiment/"game."

您可能需要实施解决方法以获得平滑的帧率.

you may have to implement this workaround to get a smooth framerate.

这篇关于如何使用 Unity 使用 ARCore 录制视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 11:13