在空中旋转 Android 的 RAW 相机(不仅仅是视频)

发布于 2024-11-03 07:43:45 字数 1215 浏览 2 评论 0原文

我正在使用 Flex Hero Pre-release 4.5,这是一个适用于 Android 的 Flex 移动应用程序。

我遇到的情况是原始相机显示在屏幕上并在网络流中传输。显然,现在在 Android 版 AIR 中,如果您只是在纵向中使用原始相机,它实际上并不会以纵向方式拍摄相机......它的方向是 90 度。所以,这是一个代码片段,我在其中旋转了视频,它在手机上看起来很棒。但是,我需要将摄像头连接到网络流并发送它......但它发送横向视频,而且我真的不想在远端调整它。我无法将视频附加到网络流...任何人都知道我可以做什么而不是仅仅等待 AIR 更新吗?

//i know i have width and height mixed up, its because im rotating it in a second and i dont want it to be stretched
                                nearVideo = new Video(near_video.height,near_video.width);

var m:Matrix = new Matrix();
//rotate here
m.rotate(Math.PI/2); 
this.nearVideo.transform.matrix = m;
//repositioning it so it looks like its fitting in the container correctly
nearVideo.x=near_video.width;
nearVideo.y=(near_video.height-near_video.height);

if (Camera.isSupported)
{
nearCam = Camera.getCamera();
}

nearCam.setMode(near_video.height,near_video.width,10);
nearVideo.attachCamera(nearCam);
near_video.addChild(nearVideo);

//now its all great on screen...but when this comes up

sendStream.attachCamera(nearCam);

//i’m sending sideways video... 

编辑:我知道我可以告诉远端仅旋转其用于显示侧面摄像机的视频对象。但由于多种原因,这不是我想要接受的解决方案。希望 adobe 能尽快解决这个问题。但在那之前我只是好奇是否有人知道我如何旋转相机并将其连接到网络流。

I'm using the Flex Hero Pre-release 4.5 and this is a Flex Mobile application for android.

I have a situation where the raw camera is being displayed on the screen and its being transmitted in a netstream. Apparently right now in AIR for android if you’re simply using the raw camera in portrait it doesnt actually shoot the camera in portrait...it’s 90 degrees in the wrong direction. So, here’s a code snippet where i rotated the video and it looks great on the phone. however, i need to attach the cam to a netstream and send it...but it sends sideways video, and i dont really want to adjust it on the far end. and I can’t attach a video to a netstream...Anyone have any ideas what I could do rather than just waiting for an AIR update for this?

//i know i have width and height mixed up, its because im rotating it in a second and i dont want it to be stretched
                                nearVideo = new Video(near_video.height,near_video.width);

var m:Matrix = new Matrix();
//rotate here
m.rotate(Math.PI/2); 
this.nearVideo.transform.matrix = m;
//repositioning it so it looks like its fitting in the container correctly
nearVideo.x=near_video.width;
nearVideo.y=(near_video.height-near_video.height);

if (Camera.isSupported)
{
nearCam = Camera.getCamera();
}

nearCam.setMode(near_video.height,near_video.width,10);
nearVideo.attachCamera(nearCam);
near_video.addChild(nearVideo);

//now its all great on screen...but when this comes up

sendStream.attachCamera(nearCam);

//i’m sending sideways video... 

edit: I know i could tell the far end to just rotate the video object its using to display the sideways camera. but for many reasons that's not the a solution i want to accept. Hopefully adobe will just fix this soon. But until then im just curious if maybe someone knows how i can rotate the camera and attach it to the netstream.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

遗忘曾经 2024-11-10 07:43:45

嗯,对我来说,除了在远端旋转视频之外,唯一真正的解决方案就是让 adobe 修复相机。因此,如果您发现此页面是因为您对 Android 上的相机无法正确旋转纵向感到沮丧,请在此处投票支持该错误并让他们修复它:

http://bugs.adobe.com/jira/browse/SDK-30317

Well, To me it's looking like the only real solution other than rotate the video on the far end is to just get adobe to fix the camera. So, if you found this page because you were frustrated with the camera on android not being able to rotate correctly in portrait please vote up the bug here and lets get them to fix it:

http://bugs.adobe.com/jira/browse/SDK-30317

新一帅帅 2024-11-10 07:43:45

遗憾的是,您无法在将摄像头流发送到服务器之前拦截并对其进行修改,这是一个错误,希望 adobe 将在下一版本的 Air 中修复。如果没有打开的票证,您应该打开一张。

然而,并不是一切都失去了!相机类对 NetStream 的作用本质上只是发送相机捕获的视频字节,当然还有一个取决于带宽的质量改变算法。您可以尝试自己做同样的事情,但是质量改变算法会更难实现,但并非不可能。

本质上,由于您在某处显示摄像机视频(也许是 Video 类?),您可以获取该位图数据,将其转换为 ByteArray 并使用 send 通过 NetStream 发送它。当然,服务器(或其他客户端)需要知道如何处理它。

无法保证这是否有效,因为我从未尝试过,但这就是我会做的。另一种方法是“告诉”媒体服务器(我假设您正在使用一个)您当前处于横向模式(只有一个布尔标志),然后服务器可以为您进行转换,将其发送给其他人。

不管怎样,这都不会容易。祝你好运。

Sadly, you can't intercept the camera stream to modify it before sending it off to the server, this is a bug that hopefully adobe will fix in the next version of Air. If there is no tickets open for it, you should open one.

However, not all is lost! What the camera class does with NetStream is essentially just sending the video bytes that you camera captures and of course there's a quality changing algorithm depending on bandwidth. You could try to do the same thing yourself, however the quality changing algorithm would be a bit harder to implement, but not impossible.

Essentially, since you're displaying the camera video somewhere (Video class maybe?), you could take that bitmap data, convert it to a ByteArray and send it over the NetStream using send. Of course, the server (or other client) would need to know what to do with it.

No guarantees if this would work well as I've never tried, but this is what I would do. Another way of doing it would be to 'tell' the media server (I'm assuming you're using one) that you're currently in landscape mode (just have a boolean flag) and then server can do the transform for you and send it off to the other person.

Either way, it won't be easy. Good luck.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文