录制时逐帧处理 Android 视频

发布于 2024-12-26 15:41:03 字数 368 浏览 2 评论 0原文

我想做的是创建一个应用程序,在录制时为视频添加效果。有没有办法让回调方法接收帧,然后对其应用效果并记录下来。目前 Android 市场上有一个应用程序(Videocam Illusion)声称它是唯一可以执行此操作的应用程序。有人知道 Videocam Illusion 是如何做到这一点的,或者有一些概述 Android 视频处理的可能教程的链接吗?

这是一个未回答的类似问题:

视频录制时的 Android 预览处理< /a>

What I am attempting to do is create an application that adds effects to videos while recording. Is there any way to have a callback method receive the frame, then apply an effect to it and have that recorded. There is currently an application on the Android Market (Videocam Illusion) that claims it is the only application that can do this. Anyone know how Videocam Illusion does this or have some links to possible tutorials outlining video processing for Android?

This is a similar question that is unanswered:

Android preview processing while video recording

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

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

发布评论

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

评论(1

海未深 2025-01-02 15:41:03

不幸的是,(除非我不知道 API 提供的其他方法)这样做的方式是使用到相机的直接流并通过使用某种本机代码来修改流来操作它。我之前在开发眼球追踪器时做过类似的事情 - 所以我会告诉你它基本上是如何工作的。

  1. 使用 NDK(可能是 api,具体取决于实现)打开流
  2. 修改流的字节 - 每个帧作为单独的数据包发送。您必须从相机中抓取每个数据包并对其进行修改。您可以替换颜色,也可以进行翻译。您还可以使用 OpenGL 通过添加玻璃效果等内容来完全修改图像。
  3. 将图像展平,然后
  4. 将图像发送到视图控制器进行显示。

您必须注意的一件事是数据包的加载和发送以及数据包的加载和发送。每帧图像发生时间约为 1/30 秒。所以代码必须极度优化。

Unfortunately, (unless I'm unaware of some other method provided by the API) the way this is done is using a direct stream to the camera and manipulating it by using some sort of Native Code to modify the stream. I've done something similar to this before when I was working on an eyetracker - So I'll tell you how it works basically.

  1. Open a stream using the NDK (possibly api, depending on implementations)
  2. Modify the bytes of the stream - each frame is sent as a separate packet. You have to grab each packet from the camera, and modify it. You can do a replace of colors, or you can translate. You can also use OpenGL to modify the image entirely by adding things like glass effects.
  3. Flatten the images back out
  4. send the image over to the view controller to be displayed.

One thing that you have to be mindful of is the load and send of the packets & images happen in about 1/30th of a second for each frame. So the code has to be extremely optimized.

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