Android capture internal (application) audio - android

I want to capture internal audio, programmatically. For instance, I want to play an audio file (on my device) and then capture the audio output - not using the microphone with the volume turned up.
Example use case: I want to make a library that other developers can use in their games, allowing users to record in-game audio.
Android says there is Playback Capture functionality, however, I just cannot find an example. I've googled for hours. Whenever I google 'android capture app sounds' or 'android record audio', I either get links to voice recording apps or some code recording from the microphone (usually nearly 10 years old)... e.g
Does anyone have a link to a working example?

You can reference MediareCorder with https://developer.android.com/guide/topics/media/mediarecorder

Related

Android record camera and music from players

I am trying to do following functionality in my mobile app:
1) In my app I have record button. When pressed it starts camera recording
2) if I have music playing in my mobile phone in any of
players - this music should overlay the video
3) External microphone
in this situation should also record additional sound
So as a result we will have video record+music+microphone sound
Right now, I got stuck while trying to get access to android.permission.CAPTURE_AUDIO_OUTPUT
(I am not using root access btw and can't use it)
Is there a way to solve 1+2+3(record+music+microphone) ? If yes, how can one solve it?
Not really an answer, but too long for a comment.
Guess you should take a look at MediaRecorder here and the android.permission.RECORD_AUDIO permission. But MediaRecorder is only working with MediaPlayer. So if you are using Exoplayer or similar it's not a solution. Be aware, that this might not work on all hardware devices and with all Android Versions (I think you should test with Android 10 first)!
Be aware of AudioFocusManager on Android. If you start the camera, it will request the AudioFocus, so other music apps on your device will stop playing music if you request the camera with sound. (There are differences between Android 10 and below).
Furthermore, camera is using device microphone, so I think recording microphone and camera input at the same time might not work, but you can always use the video-sound in this case.

Problem in using Android 10 API to capture audio playbac

I hope this message finds you well. We are writing to ask some help on Android 10 API and its new functionalities. We are trying to build an application that captures only the important parts of videos and audios without saving the whole thing.
To do that our first objective is to capture playback audio in Android 10. We have tried the following two methods:
1st Method:
We have tried to capture audio on Youtube using Playback capture API introduced for android 10 but the resultant audio file produced only silence. In the documentation, it was written that when one wants to capture an audio file on a third party application, one can use "allowAudioplaybackCapture = true" in the manifest. We have already used this in manifest but it did not work.
We tried this method on YouTube first. It’s very likely that YouTube prevents capturing audio playback so we tried on a local audio file. The result was the same as before.
2nd Method:
We tried to record internal audio capture with media projection which is allowed for android 5.0 to android 10 (It works fine). The problem is that it captures internal audio along with external audio i.e microphone data. When we tried to mute the external audio capture, it also muted the internal capture.
Please see the code block below to have a better idea:
https://pastebin.pl/view/b2f4ec78
We would be grateful if you can give us some pointers. We have tried every documentation that is available but we could not find any solution.

How can I record a video with sound of my app using Android Studio?

I am developing an app with Android Studio 2.1 and I would like to record a video of an usage example, with sound.
I have already recorded some videos, but always without sound. As the sound in my app is a key feature, I would like to have the video with the audio output of my app.
Is it possible? In case it is, how could I use it?
Thanks!
Maybe you should try using external app for recording both screen and sound. I have dig in just few mins and i have found some apps.
Here I left link to a top http://www.androidauthority.com/best-screen-recording-apps-600838/
The last one seems to be the one you are looking for (SCR Screen Recorder, which requires root), hope it works!
Other option could be to use a male to male audio cable and record the audio transmitted to the pc.

Screen and audio cast for Google Glass app demo

I am working on my Glass app demo and I used droidAtScreen to project the screencast from MyGlass for the presentation. The problem is that I cannot demonstrate the voice responses from the Glass based on user input. My backup plan is to record a video for demonstration and insert the voice output manually. Does anyone know if there is a better way to do both screen and audio cast for Google Glass app demo? Thanks for the help.
Have you tried Android Screen Monitor? I always use ASM.jar for any demonstration and it works fine with both audio and video demonstrations.
The link to download ASM.jar is here.
Detailed description is here. If you're using Droid#Screen than probably you know how to run Android Screen Monitor (ASM.jar), but here is a link for a reference that explains the process in detail.
This is how I solved the problem initially.
Use Screencast-O-Matic to record the video of screencast on my
laptop. The screencast is done using DroidAtScreen with
highest frame rate possible option checked. It has better frame rate than ASM screencast. During the video record session, my voice was captured. (so in other words, choose a
quiet place!!)
For simulating the Text-to-Speech engine voice, I used SitePal
demo site and the voice is Julie (US). It's the closest voice I could
find that matches the Google Glass speech engine. To record the
voice, I used Audacity and export it to .wav audio file. The key
is to play the video and find the exact time to insert the audio
file using any standard movie maker software.
UPDATE
Just finished the demo presentation at IT Expo. To my surprise, the simplest solution worked the best.
Create the video demo (under 2 minutes) as mentioned above but insist
on asking an audience to try it out.
Ask the person to say what
he/she heard from the Glass app as a response to the action (ex. The
item is saved)

Record Android Audio Output

Many people are asking for this, no one seems to have an answer so I do neither.
How is it possible that some apps serve the function to record the audio output of the android system? Everything I am finding is the very same tutorial on 1432 different sites where you can record MIC input. I don't care about mic input, I want the audio output and just can't imagine how to access it.
If everyone can get me on the right way, I would be so happy.
Seems to be currently there is no way to achieve this.
This is another question related to this : android get device overall audio output in pcm
The closest API available to you for these purposes is Visualizer. Which only captures "partial and low quality audio content".
I imagine direct audio capture functionality is omitted to prevent pro-piracy apps. It may be worth noting that there is a CAPTURE_AUDIO_OUTPUT permission, but it is "Not for use by third-party applications". So if you really do have legitimate apps that are capable of this, as you claim, they are likely system apps. Even if you wrote an app that generated its own musical sequences, for example, you would still have to write your own encoder/decoder to achieve anything close to what you're asking for (and that wouldn't even be considered audio capture at that point.)
To put it bluntly, it's currently impossible without breaking any ToS with Google or your phone provider, and will probably remain so indefinitely.
In Android 10, they have introduced Audio Playback Capture API using which we can capture the Audio being played by other applications. But it's not available in previous android versions.
An app X can also prevent any other app from listening, if that app hasn't added any constraint then this API can be used.
Just Use a bidirectional AUX Cable and hook it in your phone Headphone Port and hook it's another end to your Audio Interface "Line In" Channel (Or Whatever Input You have on your Audio Interface ) and then record that input by audacity or any good Audio Recorder.
TL;DR : use the SCR Screen Recorder app to capture video + internal audio (not microphone) [require root]
Long answer
Original answer: Record tablet's screen AND audio
Jeff's answer seems to be the only way you can use through adb. But that force you to do some work (merge video + audio).
I could do it this way :
- connect the Android device to computer with a jack cable (headphone output to microphone input);
- record video with adb shell;
- record audio with Audacity (or anything else)
- then merge video and audio with a video editor (pitivi, openshot, avconv...)
Another way is to directly use an android app:
SCR Screen Recorder - official website - XDA - short review
Mobizen for SAMSUNG - google play
RecMe - google play
SCR Screen Recorder:
pros :
the only app that truly works for recording video + internal audio with all devices
cons:
banned from google play because of SELinux policy (see XDA - Google Play ban and "Dangerous app" warning)
require root for recording internal audio
Mobizen for SAMSUNG:
pros
on google play store
cons
only the samsung version works for recording internal audio, the general or LG, XIAOMI version can't record internal audio
still a beta feature
require root for recording internal audio
RecMe:
pros
on google play store
cons
internal audio recording doesn't works on most devices
require root for recording internal audio
Personally I tried a lot of apps and the only working for me is SCR Screen Recorder.
PS : all these apps works without root if not using internal audio.

Categories

Resources