How to replace audio of a video in Android - android

I'm trying to replace the audio of a video in Android.
I think to solutions like mute the video and put on it an audio track, but
that not works very well if you want to save the video with the track on.
Is there a way to replace the sound part of a video to make it savable?
Thanks in advance.

I guess there are easier solutions, but it seems to be possible to use ffmpeg on android (FFmpeg on Android might get you going at installing it). You can then strip the audio (if you have set an audiosource while recording), and add other audio to your video. You can find many example ffmpeg-commands on how to remove from and add audio to your video.

Related

ExoPlayer playing currently recording media files

Let me refraise my question, I wrote it in a hurry.
Current situation:
I have set up a digital video recorder to record broadcasts provided via DVB-C. It is running on a raspberry 3B using TVHeadend and jetty/cling to provide UPnP and other possibilities to access media files. For watching recordings, I wrote an android player app using IJKPlayer, which runs on smartphones, FireTV and AndroidTV.
One hassle when playing media files which are currently beeing recorded is, that IJKPlayer doesn not support timeshifting. Means, when I start playing a currently recording file, I can only watch the length which is known by the player at that moment. Anything which is recorded afterwards can not be played. I need to exit the player activity and start it again. I have resolved that issue by "simulating" a completed recoding using a custom servlet implementation. Since the complete length of the recording is already known, I can use ffmpeg to accomplish this.
Future situation:
I plan to move away from IJKPlayer to ExoPlayer, because it supports hardware playback and is much faster when playing h.264 media. I can of course use the same solution like above, but as far as I have found out yet, ExoPlayer can support media files which are currently being recorded by using the Timeline class. However, I don't seem to find neither a usefull documentation nor any good example. Hence, I would appreciate any help with the timeline object.
Regards
Harry
Looks like my approach won't work. At least, I didn't find a solution. Problem is, that the server returns the stream size as it is during player-start-time. I didn't find a method to update the media duration for "regular" files.
However, I can solve the problem by changing the server side. Instead of accessing a regular file, I convert the file to m3u8 in realtime, using ffmpeg. I then throw the m3u8 URI onto the player and it updates the duration of the stream (while playing) without the need to create any additional code on the client side.

Record Screen video along with the audio

I want to implement screencast feature in my Android app, i.e. Recording the audio and the screen video at the same time and converting it to a .mp4 file.
I got to know that there are some Media Codecs inbuilt in the Android SDK, but the issue with those ones is that I will need to record video and the audio separately and then stitch both of the elements together to create a complete video.
I want to know if a library exists which can directly record both the Audio and Video without the need to stitch them later on.
Thanks in advance!
this project can help you get started here

Android mix audio into a playing stream

I am looking for a way to mix an audio into an already-playing mixed audio stream. For example, when a sound is being played half way through, I want to add in another sound to play together without interrupting the first sound to continue. I would also like to have an ability to withdraw a playing sound stream from the mixed playing stream. Going through Android's relevant document, I think that the only possible solution is to use native OpenSL ES via JNI to develop my own library where I can programmatically mix in/take out an audio stream from mixed audio streams. I would like to hear if anyone has a way to achieve it with less effort.
Thank you
Chris
Have you considered SoundPool?
http://developer.android.com/reference/android/media/SoundPool.html

Audio Crossfading in Android

I am develping a media player for my learning purpose and I want to have crossfading feature in media player app. But I don't have clue where to start from. i tried searching on inernet but no luck. I am using Android MediaPlayer class for all media player related operation. Anyone know any workaround to achieve the same.
thanks for your support
Try to use the AudioTrack instead of MediaPlayer. Generally, I'd suggest the following plan:
Learn some sources for an app that uses AudioTrack. A good player can be found here
This is an aac audio player that uses JNI for aac-audio decoding.
Find a MP3 decoding library. The library should be a Java one (look at this for example, or it is possible there are another libraries (I did not use such java libraries)) or a C/C++ library (in this case you also will use it through JNI).
When you will get simple working MP3 player, add manual crossfading (this should be easy, if you aware of basics of digital audio).
Try to use two objects of MediaPlayer one after another with crossfade, like in this class https://github.com/psaravan/JamsMusicPlayer/blob/f165057dd664727ed06b9fac2c27557e5fb7e7ee/jamsMusicPlayer/src/main/java/com/jams/music/player/Services/AudioPlaybackService.java
When second mediaPlayer stars first pauses for while (On some devices mostly on samsung )so transition is not smooth. MediaPlayer has this issue and its been reported to google since long ago but still not resolved(https://issuetracker.google.com/issues/36931073) so we can do nothing about it. So I used Exoplayer for playing audio and it works very smoothly without any pause.

Android Mediaplayer for voice playback

Is there any possible that we can playback our recorded voice in android through media player with the format of wav or mp3 instead of 3gp or mp4.
if it is possible please give me a source code or URL.
Thanks in advance.
I've already seen this kind of question. All yours...
https://stackoverflow.com/questions/5165295/android-voice-recording
Android audio and voice processing
Android Audio record
https://stackoverflow.com/questions/5234017/android-voice-recording-in-wav-format
Please be more specific describing your problem. I think the first step would be, to show us, what you've got until now. As this is a place to solve specific problems, I would recommend you to take a look into the "What kind of questions can I ask here?" section in the https://stackoverflow.com/faq.
3GP and MP4 are video formats. MP3/WAV are audio formats. The MediaPlayer class definitely supports both MP3 and WAV, as well as MP4 and 3GP. View this link for a list of all supported media formats on Android.
Here is the MediaPlayer Audio sample part of the API Demos application. You could try using this code to play your audio.

Categories

Resources