如何将任何 Android MLKIT 检测记录到视频中?
我正在构建使用cameraX在用户身体上显示实时滤镜的应用程序,但我不知道什么是录制/捕获带有叠加层的视频的最佳方式。我尝试过屏幕捕获,但它不起作用,我尝试了多种其他方法,但尚未成功
对于代码参考,我正在使用此示例代码 - https://github.com/android/camera-samples/tree/main/CameraXAdvanced
I'm building app that uses cameraX to display real-time filter on users body, but I am not aware of what would be best way to record/capture video with overlays on it. I've tried screencapturing, but it does not work, I've tried multiple other methods, but no success yet
For code reference, I'm using this sample code - https://github.com/android/camera-samples/tree/main/CameraXAdvanced
For example, I'd like to make a recording of something like this with all overlays/details on the screen
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我经过大量研究和测试后编写了这个应用程序
带有车牌和面部模糊的行车记录仪
该逻辑是一项为 mlkit 实时获取相机并为叠加层创建位图的服务。
叠加层无法实时应用于视频来保存它,因此我通过 MediaRecorder 中的 createVirtualDisplay 将叠加层实时叠加到屏幕中的视频上。
这真是一团糟,但它确实有效。
注意:服务的逻辑可以直接移至 MainActivity 中,但我已经将其放在 Jarvis 应用程序中(私有),所以我保留了它。
I wrote this app after a lot of study and testing
Dashcam with license plate and face blurring
The logic is a service that takes the camera in real-time for mlkit and creates bitmaps for the overlay.
The overlay cannot be applied to the video in real-time to save it so I superimpose the overlay to the video in real-time in the screen that the video of this via createVirtualDisplay in the MediaRecorder.
It's a real mess but it works.
NB: the logic of the service could be moved directly into the MainActivity but I already had it in the Jarvis app (private) so I kept that.