I want to find a way to create a new MP4 container and add an MP3 file into it. Whether the MP3 file is to be encoded or not does not matter to me. Is there any easy way to do this without using ffmpeg? I have found the following example for muxing:
android - How to mux audio file and video file?
Though, it has issues and also it is supposed to mux the audio file into an existing video.
Can someone point me to a guide or at least in the right direction to accomplish what I need?
U can do this using MediaCodec and MediaMuxer but right now i think mp3 is not supported u should first decode mp3 to wav and encode to supported format like aac using MediaExtractor and MediaCodec and then u can add to mp4 container using Muxer. U might find this link helpful https://www.sisik.eu/blog/android/media/mix-audio-into-video
Related
I'm getting started with lwjgl and openal, so I want to be able to decode an ogg vorbis file and play it with openal. My question is: how can I decode an ogg file from java, get the frequency, pcm data, etc. and send it over to openal so I can play it? I found jorbis to do this, but it seemed just too difficult to use, and the tutorials online are kinda messy. I was thinking of something like alutLoadWavFromFile but for ogg(and java).
Thanks!
EDIT: Ok, I'll clarify my question. I want to decode an ogg file. And then send the data to openal. But the only part I don't know how to do is the decoding part.
VorbisJava does exactly this. There is a reasonable example in the tools directory.
https://github.com/Gagravarr/VorbisJava/blob/master/tools/src/main/java/org/gagravarr/vorbis/tools/VorbisCommentTool.java
VorbisFile vf = new VorbisFile(new File(inFile));
Also, Java Sound API has an extensible service provider model. You can add OggVorbis as a provider.
See How can I decode OGG vorbis data from a ByteBuffer?
I want to compress an input mp4 video file using android's mediacodec for decoding and encoding and the mp4parser library for muxing to mp4. I found a number of samples on the internet, but none of them are clear to me, and I can't get them to work.
I know I can use MediaExtractor to read the input file, and decode and encode with
lower bitrate using MediaCodec, but every code sample crashes horribly.
The project target is API level 16, so I can't use the MediaMuxer class, and instead want to use mp4parser or some library similar to it.
Does anyone have experience with this workflow, or knows how to use the MediaCodec class properly to decode an input mp4 and encode it again?
I have to convert an mp3 data into wav in java.I am using JMF with mp3plugin.jar ,I am able to play the mp3 with it,seems there is a way to convert it into wav along with channel,bitwidth and fps information which I need to process further,but don't know how to do it.Any help is admired
I would like to perform a FFT on frames of an MP3 file using Java (think spectrum analyzer). I found JLayer which seems to fit the requirement of MP3 Decoding, but I'm not sure how to use it (Most examples are simply players that use the higher level helper, but that's not what I am looking for). FFT seems easy compared to decoding MP3 files ;)
My question is basically this: How would I take an MP3 file in java, and decode it to raw audio data for analysis in Java using JLayer
I am on the same Boat - trying to decode and analyze MP3 files using Java. You may want to check out MP3 SPI from the same author. There is a good example of getting the raw decoded PCM data from an MP3 file in his page:
http://www.javazoom.net/mp3spi/documents.html
Good luck,
Uri
I need to convert mp4/flv files info mp3 in my Android application, but I don't know C/C++ and Android NDK. Do you know libraries/methods for easy converting on Java? Thank you for anyway.
Your question is how to extract audio from MP4/ FLV files and save as mp3 file. Right ?
Then, very sorry, Android SDK does not provide any API for transformating or track extraction.
Also using available media framework to achieve the same is also not trivial (and even if you do, you will lose portability).
What I would suggest is to use your MP4 & FLV Parser to extract audio track, do transcoding (if audio track is non-mp3), and save the transcoded (if audio track extracted is mp3, then extracted data) data.
Or you can port FFMPEG code base and use the same. This again may be overkill for your small task.
Suppose you just want to extract mp3 track from MP4, then you understand the native mp4 parser and use the APIs for extraction. You may have to replicate some code from stagefright / opencore.
Shash
it's probably irrelevant for you anymore but if some one still need a mp4 to mp3 parser here's an api that can do the job