如何使用带有Unity的ARCore录制视频? [英] How to record video with ARCore with Unity?
问题描述
我已经在这个问题上停留了一个多月了.当人们使用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解决方案,但理想情况下,我想使用Unity.感谢您的任何帮助,谢谢!
I know that there is an Android solution but ideally I want to use Unity. Any help is appreciated, thank you!
3.从ARCore计算机视觉示例提供的纹理读取器api中保存纹理.
目录中有一个Computer Vision示例.而且我可以使用其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仍然不可接受.底线为30fps时的720p.
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.
推荐答案
您可以使用(确实很棒)资产商店链接)和相关的 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录制视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!