【发布时间】:2019-12-08 07:55:50
【问题描述】:
我正在处理一个 HoloLens 项目,并希望添加一个功能,将屏幕截图从我的 PC 实时流式传输到 HoloLens。幸运的是,我找到了一个存储库https://gist.github.com/jryebread/2bdf148313f40781f1f36d38ada85d47,非常有帮助。我在客户端修改了一点 Python 代码,以便在我的 PC 上获取屏幕截图,并将每一帧连续发送到 HoloLens。然而,HoloLens 在图像接收器运行时表现不佳,即使是可手动拖动的立方体也无法平滑移动,整个帧率下降。
我曾尝试在 Unity 中使用 Holographic Remoting Player,例如 https://docs.microsoft.com/en-us/windows/mixed-reality/holographic-remoting-player。这样,我只需要在本地读取我的 PC 的屏幕截图,并将整个渲染帧发送到 HoloLens。但是,当我播放 Unity 场景时,包含屏幕截图的原始图像会显示在 Unity 中,但不会显示在 HoloLens 上。
我使用 IEnumerator load_image() 和 StartCoroutine("load_image");从我的电脑加载图像。我用来加载图像并在 UI-RawImage 上显示的代码是
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System.IO;
public class LiveScreen : MonoBehaviour {
public RawImage rawImage;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
StartCoroutine("load_image");
}
IEnumerator load_image()
{
string[] filePaths = Directory.GetFiles(@"G:\Files\Pyfiles\", "*.jpg"); // get every file in chosen directory with the extension.png
WWW www = new WWW("file://" + filePaths[0]); // "download" the first file from disk
yield return www; // Wait unill its loaded
Texture2D new_texture = new Texture2D(320, 180); // create a new Texture2D (you could use a gloabaly defined array of Texture2D )
www.LoadImageIntoTexture(new_texture);
rawImage.texture = new_texture;
new_texture.Apply();
}
}
谁能给我一些建议,告诉我如何在 HoloLens 上提高 APP 的性能,或者我是否可以在这个项目中使用 HoloLens 的远程渲染?
提前致谢。
【问题讨论】:
-
欢迎来到 StackOverflow!不幸的是,这个社区不是外部资产的搜索引擎。要求我们推荐或查找书籍、工具、软件库、教程或其他场外资源的问题对于 Stack Overflow 来说是无关紧要的,因为它们往往会吸引固执己见的答案和垃圾邮件。相反,请描述问题以及迄今为止为解决该问题所做的工作。但是,有一个资源可以帮助您入门:unitylist.com/p/fdt/u-Texture-Send-Receive 它使用 UDP 在两个 Unity 实例之间同步纹理。在 MagicLeap 上完美运行
-
您应该在您的 PC 上本地录制屏幕并将其作为流式传输(如 ffmpeg)发送到 Hololens。如果您使用 unity 开发 Hololens App,derHugo 提供的链接显示了如何在 Unity 中播放流媒体。
-
感谢您的帮助。抱歉,这是我第一次提出问题,所以当我试图描述它时可能会出错。这个资产很酷。但是,对于这个项目,我必须使用 HoloLens,并且我已经测试过该资产不适用于 HoloLens,因为 HoloLens 的某些功能使用 UWP。我会尝试 ffmpeg 并非常感谢您的帮助。