Search code examples
androidaudioaudio-recordingvideo-recording

How to video record with specific sound programmatically in android?


I have created functionality to record video in my app.

When I play a song, that song is recorded with video and a video file is created, similar to a dubshmash application.

Now the problem that I am facing is that other voices such as near by sounds also get recorded. The song file is recorded in the video record screen and I play the song when video recording activity launches.

How can I have my application record only song with video?

 mediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
  mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
  mediaRecorder.setProfile(CamcorderProfile.get(CamcorderProfile.QUALITY_HIGH));

Is there any solution in audio source set as a speaker , because song sound going through a speaker? if is it another possible way please reply me.


Solution

  • If you want to working with video then you have to use FFMPEG library

    That can be you can work with Video.

    That for i have already give answer to How to use ffmpeg in android studio? see this LINK. Go step by step and import in your project