Streaming .wav with jmf and rtp protocol - java

I would like to implement a simple Client Server model based on jmf and rtp to access .wav file and play it.
I refer to this discussion MP3 won't stream with JMF
where the problem was with .mp3 and so I tryed it with my .wav without success because I've problem with RTP Session Managaer.
A first question is if I have to run RTPClient and RTPServer with two different machines, because until now I have RTPServer and RTPClient on the same pc in the same project and in package only different.
Is it a problem? Is there a way to try the client-server model on localhost for example?
Thanks in advance for your attention!

Related

How can I stream in android with ftp server?

I can upload and download files on my android app. However, I wish to stream video and audio over 3g/4g like an 'ES File Explorer'. But the problem is I couldn't approach it.
Could anybody tell me a method about ES File Explorer's streaming skill?

How to decode ogg vorbis file java?

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?

How to reduce Audio and Video file size while downloading from server in Android app?

I need to either play or download audio/video files hosted on a server.
While downloading, I need the file to be downloaded in compressed size.
How to achieve that?
Any help would be appreciated.
Audio and video file formats typically employ compression already, so you can't generally do any further compression on them. Thus the good news is that you have nothing to do - your current downloading mechanism already includes compression!

Play m4a files in Java

I want to create a media player in Java. The mp3 support already works with the JLayer library but which library can play m4a files?
I read about vlcj here on stackoverflow, but this seems to depend on Swing/AWT which I wouldn't use because I want to port the application to Android later on.
Have you looked at JAAD? It's a Javasound SPI that decodes AAC audio, I've used it with success previously.
Note that m4a is a container format, and while it usually contains (in my experience) AAC audio, in theory it could contain other formats instead.
You can find some information about getting it working without Javasound (and a test case) here.
This answer is indirect. I don't really know anything about m4a files. But what I have found is an open source library that can stream them as a flash server named red5. It's written in Java so theoretically you should be able to browse their code to figure out how to do it.
Hopefully someone here can give a more direct answer, this is the best I can do.
If you have Java 7 or later, you have access to the Javafx library. You can also use your media player (like iTunes or Windows Media Player) to convert to the simpler mp3 version and run that. I wouldn't recommend .wav files as they have significantly more data usage than mp3s, (which condense the file size by compressing the .wav data and omitting inaudible and otherwise garbage-y data).
import javafx.scene.media.*;
String name = "song.mp3";
Media song = new Media(name);
MediaPlayer player = new MediaPlayer(song);
player.play();

RTSP streaming of video files to 3gp

One of my friend wants to build a mobile site. He also has a couple of video files that should be streamed on to visitors mobile when chosen. I want to know if there exists a library to stream a video over rtsp in java. I tried this one http://www.csee.umbc.edu/~pmundur/courses/CMSC691C/lab5-kurose-ross.html. But it had too many incomplete code and was giving errors.
VLC has a nice streaming (over RTSP) functionality. Maybe you could look at streaming in VLCj: http://code.google.com/p/vlcj/wiki/Streaming
May be you should try Xuggle with this tutorial: http://www.javacodegeeks.com/2010/05/rtmp-to-rtsp-re-stream-using-wowza-and.html
RTSP is the negotiation protocol you can use something like JBoss Netty for tat. Then you need something to stream the media itself which is done via RTP. You can use Gstreamer (which has Java binding)

Categories

Resources