Can we use .wma sound files in andengine? - android

I am trying to use one sound file with wma extension. But when I try to play it, it doesn't play. Do andengine support .wma extension files?
Sound sound = SoundFactory.createSoundFromAsset(activity.getSoundManager(), activity, "mfx/sound111.wma");
sound.play();
But it doesn't play.

Finally got the answer. I will have to use mp3 or ogg rather than wav format. Because wma is a closed format and it's support depend on some libraries not always available on Android devices, and they're not part of the AOSP (Android Open Source Project) tree itself.

Related

playing a MP3 file android NDK using openSL from memory

I have my android app where data is packed using FileWrap. The thing is I want to wrap the mp3 data into the android file and play from that memory. I have checked the nativeaudio example in NDK which shows how to play MP3 as an asset or as a filesystem file, but it does not show how I can play an MP3 that is embedded into memory.
Please help. Thanks.
I don't think that is possible... yet.
AFAIK android opensl only supports MP3 decode & playback from a stream...
I have not seen the latest ndk release (r9b) yet, but if the opensl example app does not support in-memory, on-the-fly decoding, I doubt it is available.
Perhaps having a look here may clear things up:
https://groups.google.com/forum/#!searchin/android-ndk/opensl|sort:date/android-ndk/cMHlkyQkFU0/vMkyO2201yYJ
Or you could just dump your MP3 files in the "assets" folder and play them using the AAssetManager as per usual.

How to use Stagefright in Android?

I want to play .ts video file in my application.I am not getting any way do it.
I doubt it whether it is possible to do it or not in Android.
I have heard about Stagefright framework.So please tell me how I can use Stagefright in my application & whether it is able to play a .ts file or not.
Or is there any other way to play .ts file?
Thanks
There are 2 frameworks in Android(Stagefright & Nu-Player)
For Local Playback & Progressive Download(You-Tube) - Stagefright
For Streaming(rtsp/HLS) - Nu-Player
Coming to TS, if it is hosted in server and if you try to stream(http:///1.ts), then it is treated as Progressive Download(PD) just like You-Tube by your Android phone.
To play a local/PD content, Stagefright loads a Parser component(MPEG2TSExtractor.cpp) to parse the TS contents. In older version, the above mentioned parser module didn't have support for Progressive Download. That's the reason playback was not successful.
In recent versions this support is added.
If you are writing an APP, then you can rely only on existing Stagefright.
MXPlayer has it's own Multimedia framework to play the content.
I think that Android stagefright does not support playback of .ts (transport stream) or elementary stream. It only supports MP4/3GP/MP3 file formats or HLS playback(m2u8).
You can use the HLS(HTTP Live Streaming) to play your file, but you have to pass an url with this type http://xxxxxxxxxx.com/playlist.m3u8. You have to store your .ts files in the server though. Please refer here for more details.
Use GStreamer. It has support for Android, and can decode TS files.
Tutorial 5 needs a slight modification in Android.mk (in jni directory) to include TS plugins in GSTREAMER_PLUGINS:
mpeg2dec mpegdemux2 mpegtsdemux mpegtsmux
Then you are good to go. This is for mpeg2 inside the TS. Remember that TS is a container, so you will perhaps need to be specific on what codec the streams inside the TS are coded with.
Libstagefright has support for mpeg2ts (see on Android JellyBean framewroks/av/media/libstagefright/mpeg2ts)
It is supported from GingerBread (i guess).
StageFright has support for TS files, even though it is very limited, for starters seek is not supported.
Also it depends what video codec is being used in the TS file, StageFright implementation supports very few (only H264 i think but not sure on this). Apart from this StageFright implementation for TS files is also limited by google's TS parser implementation which is very basic too. It plays a very small subset of "possible" TS files. I say "possible" because TS standard ( ISO/IEC 13818-1) leaves a lot of room for interpretation and possibilities for encoders.

Android change audio of any video file

I am trying to apply new audio pitch for my video file.
I want to replace audio of my existing video by android code. Is it possible in android. can any one help me to do this
Is there any Android library support this facility to change audio for video file?
Any Help is appreciated...!!!
Thanks in Advance
This is not the exact solution but you can try it:
When you play the video file set its volume to zero.
At the same time use the service in which you can play any audio you want.
As service runs at background it has no effect on your video streaming.
When your video end,end your service.
And remember to set volume of your audio file.
You can change video pitch easily by following these steps :-
Add this library in your android project : https://gitlab.com/soundtouch/soundtouch.
follow this link for integrate this library process : https://stackoverflow.com/a/52425255/7899427.
After successfully integrate this library first of all extract audio file in WAV audio format. You can use ffmpeg library for do this.
Than using the soundtouch library you can change the audio file pitch and tempo rate and export new audio file in WAV format.
After complete these steps merge that converted audio file with video file.
Now will get the converted audio file with same video file.
Happy coding.

How to stream an .pls audio file in android 2.2

I am trying to play an .pls file (available at http://stream.radiosai.net:8002/listen.pls) in android 2.2. But it isn't working. Playing MP3 works fine.
A pls or a playlist file is basically a text file with the path of each track in each entry. Kind of like an .ini file. Take a look at the WP entry.
I don't think the inbuilt MediaPlayer supports these formats, so you'll have to download the file and parse the file and play the actual mp3's one by one.
Android doesn't support the .pls format. Link

Play .ts video file on Android?

I am pretty new at streaming video, so please bear with me. :)
I am trying to port an m3u8 stream over from iPhone to Android. Looking in the m3u8 feed, I found some .ts files. From what I can tell, .ts files are, themselves, wrappers that contain the video stream (Elementary Stream).
Is it possible to play a .ts file in Android? (The docs only list 3gp and mp4 as supported formats.)
Is there a way to extract the Elementary Stream and just process the video feed? If that is in 3gp or mp4, I should be ok.
Will Stagefright handle .ts? Is Stagefright even available? I read that there are/were some problems with it.
(As a further caveat, I am not getting much help from my server guys. They are pushing for a Flash player solution, including a proprietary player. They will not provide me with a 3gp or an mp4 feed, but I'm hoping I can find that in the .ts file.)
I'm open to other suggestions. Thanks for your patience with this newbie. :)
There is a standard for that called HTTP Live Streaming. Android 3.0 supports this protocol to some extent which means you can pass the URL of the m3u8 playlist to the MediaPlayer and the player should be able to stream it over HTTP. Stagefright is bundled with Android 3.0.
You can browse its source code here.
Also, this thread might interest you: it summarizes support for HTTP Live Streaming.
Android stagefright in Gingerbread and prior versions does not support playback of .ts (transport stream) or elementary stream. As you have rightly pointed out, it only supports MP4/3GP/MP3 file formats.
You can play .ts video file in android by using NDK based project. Dolphine player is best open source player for android and also supports various formats of video.
You got the .ts link from m3u file. Now you can fetch binary data from .ts file and store this binary data in file, then play this file by using video player.

Categories

Resources