Android视频删除色度键背景 [英] Android video remove chroma key background

查看:126
本文介绍了Android视频删除色度键背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已检查非常相似: 我想用Android相机录制视频. 之后,使用库删除背景,即使用色度键的背景. 首先,我认为我应该使用android NDK来摆脱SDK内存限制并使用整个内存. 视频的长度很短,只有几秒钟,因此也许可以处理它. 由于与.so文件体系结构不匹配,我宁愿使用SDK实现并设置android:largeHeap="true".

It is very similar: I want to record a video with android camera. After that with a library remove the background, which is with chroma key. First I think I should use android NDK in order to escape from SDK memory limitation and use the whole memory. The length of the video is short, a few seconds so maybe is able to handle it. I would prefer to use an SDK implementation and set the android:largeHeap="true" , because of mismatching the .so files architecture.

请提供有关SDK或NDK的任何库建议.

Any library suggestion for SDK or NDK please.

推荐答案

IMO,您应该更喜欢基于NDK的解决方案,因为视频处理是一项占用CPU的操作,而Java代码不会为您提供更好的性能.而且,最流行,最可靠的媒体处理库通常是用C或C ++编写的.

IMO you should prefer NDK based solution, since video processing is a CPU-consuming operation and java code won't give you a better performance. Moreover, the most popular and reliable media-processing libraries are often written in C or C++.

我建议您看看 FFmpeg .它提供了应对多媒体的能力. chromakey 过滤器可以帮助您删除绿色背景(或任何颜色)你要).然后,如果需要,您可以将另一个视频用作新背景.请参阅 blend 过滤器文档.

I'd recommend you to take a look at FFmpeg. It offers reach abilities to cope with multimedia. chromakey filter may help you to remove green background (or whatever color you want). Then you can use another video as new background, if needed. See blend filter docs.

过滤器是一个很好的强大概念.可以通过ffmpeg工具命令行或通过 libavfilter 来使用它们. API.对于前一种情况,您应该找到为Android编译的ffmpeg二进制文件,并使用传统的Runtime.exec()运行它.对于后一种情况,您需要编写本机代码,以创建适当的过滤器图并执行处理.此代码必须与FFmpeg库链接.

Filters are a nice and powerful concept. They may be used both via ffmpeg tool command line or via libavfilter API. For the former case you should find ffmpeg binary compiled for android and run it with traditional Runtime.exec(). For the latter case - you need to write native code, that creates proper filter graph and performs processing. This code must be linked against FFmpeg libraries.

这篇关于Android视频删除色度键背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆