Android的> 4.0:想法如何记录/捕获内部音频(如STREAM_MUSIC)? [英] Android > 4.0 : Ideas how to record/capture internal audio (e.g. STREAM_MUSIC)?

查看:880
本文介绍了Android的> 4.0:想法如何记录/捕获内部音频(如STREAM_MUSIC)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几个月前,与Android ICS(4.0),我开发了截获的pcmC0D0p - 模来获取所有系统的音频一款Android内核模块。

Some months ago, with Android ICS (4.0), I developed an android kernel module which intercepted the "pcmC0D0p"-module to fetch all system audio.

我的目标是要流的所有音频(或至少所播放的音乐),以通过AirPlay远程扬声器。

My target is to stream ALL audio (or at least the played music) to a remote speaker via AirPlay.

内核模块的工作,但在那里有几个问题(内核版本,根权限等),所以我停止了这方面的工作。

The kernel module worked, but there where several problems (kernel-versions, root-privileges etc.) so I stopped working on this.

现在,我们有Android的4.1和4.2,我有新的希望!

Now, we have Android 4.1 and 4.2 and I have new hope!

谁有一个想法如何捕捉音频的Andr​​oid?

Who has an idea how to capture the audio in Android?

我下面的观点:

  1. <一个href="http://stackoverflow.com/questions/13875126/android-possible-to-connect-bluetooth-to-self/13879176#13879176">Connect通过蓝牙以相同的电话,设置路由到BT和抢的另一端的声音:这不应该工作

  1. Connect via bluetooth to the same phone, set routing to BT and grab the audio on the "other end": this shouldn't work

截取音频内核模块像以前那样做:骨灰级,得到它的工作,但不适用

Intercept the audio with a kernel module like done before: hardcore, get it worked but not applicable

Jack音频连接工具:可悲的是Android使用tinyALSA,而不是ALSA。 TinyALSA不支持像杰克任何过滤器(但由此带来的内核模块的想法)

JACK Audio Connection Kit: sadly Android uses "tinyALSA" and not "ALSA". TinyALSA does NOT support any filters like JACK (but this brought the idea with the kernel module)

使用的PulseAudio作为替代AudioFlinger,但这也是不适用

Use PulseAudio as a replacement for AudioFlinger, but this is also not applicable

编辑(忘了他们):

  1. 我编tinymix(婴儿版ALSA混频器的)从 tinyALSA (ALSA的在Android)并试图将音频输出到麦克风输入 - 但没有成功(<一href="http://stackoverflow.com/questions/10733214/android-how-to-configure-tinymix-to-record-system-audio-with-tinycap">not可以理解的,我)。而这也需要生根:不适用

  1. I compiled "tinymix" (baby-version of ALSA-mixer) from tinyALSA (the ALSA on Android) and tried to route the audio-out to mic-in - but with no success (not understandable for me). And this also needs rooting: not applicable

我测试 OpenSL ES 的,但我不是一个C-裂缝,并在我能结束创纪录的麦克风,但没有更多的(也许是我错了?)

I tested OpenSL ES, but I'm not a C-crack and it ended in "I can record microphone, but no more" (maybe I was wrong?)

我刚刚发现<一href="http://developer.android.com/reference/android/media/MediaRouter.html#ROUTE_TYPE_LIVE_AUDIO">ROUTE_TYPE_LIVE_AUDIO:

这是支持实时音频路由功能的设备将允许媒体音频   流被路由到支持的目的地。这可以包括   内置扬声器或设备本身上的音频插孔,A2DP设备,   更

A device that supports live audio routing will allow the media audio stream to be routed to supported destinations. This can include internal speakers or audio jacks on the device itself, A2DP devices, and more.

启动。一旦该路由是透明的应用程序。所有   音频上播放媒体流将被路由到所选择的   目的地。

Once initiated this routing is transparent to the application. All audio played on the media stream will be routed to the selected destination.

也许这有助于以任何方式?

Maybe this helps in any way?

我跑出来的想法,但要破解这个螺母,也许有人可以帮我吗?

I'm running out of ideas but want to "crack this nut", maybe someone can help me?

编辑:

我真的很新的C&放大器;内核编码(但我成功创建一个交叉编译音频拦截模块) - 但不是以任何可能的方式,在将PCM数据变为从用户空间(JAVA,C层?)的点到听内核空间(tinyALSA,内核模块),没有黑客和放大器;生根?

I'm really new in C & kernel-coding (but I successfully created a cross-compiled audio-interception-module) - but isn't it in any way possible to listen at the point the PCM-data goes from userspace (JAVA, C-layer?) to the kernel-space (tinyALSA, kernel-module), without hacking & rooting?

推荐答案

您必须通过本地套接字服务器传送音频流:

You must pass audio traffic through your local socket server:

  1. 创建本地套接字服务器

  1. Create local socket server

修改音频HTTP流地址的路径是通过你的本地套接字服务器,例如用于地址

Modify audio http stream address to path is thru your local socket server, for example for address

http://example.com/stream.mp3  ->

http://127.0.0.1:8888/http://example.com/stream.mp3

,其中8888是你的插座端口。

where 8888 is your socket port.

播放

http://127.0.0.1:8888/http://example.com/stream.mp3 

使用默认媒体播放器

阅读到端口8888的所有传入的请求在您的本地套接字服务器,分析它,并传递给example.com的服务器。

Read all incoming requests to port 8888 in your local socket server, analyze it and pass to example.com server.

阅读来自example.com响应,并将其传递给本地客户端(媒体播放器)。在这里,您可以捕获音频流!

Read response from example.com and pass it to local client (media player). HERE you can capture audio stream!

这篇关于Android的&GT; 4.0:想法如何记录/捕获内部音频(如STREAM_MUSIC)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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