Playing Live streamed audio through Java - java

Are there any java libraries out there that can handle live streamed audio such as an internet radio stream that can then be played back using Java?
I've looked into stuff like Xuggler/FFMpeg but I'm not sure if they can handle the fact that I'm just trying to play a live stream.
It would have to be able to handle most/all of the formats that internet radio stations usually stream in.
Thanks a lot.

You can have a look at JMF - Java Media Framework
http://en.wikipedia.org/wiki/Java_Media_Framework
http://www.oracle.com/technetwork/java/javase/tech/index-jsp-140239.html
On the Wikipedia site is also a list of alternatives:
Freedom for Media in Java (FMJ) An API-compatible with JMF alternative !
JavaSound
QuickTime for Java
IBM Toolkit for MPEG-4
Jffmpeg
jvlc
vlcj
gstreamer-java
Cortado, a complete player for Ogg Vorbis and Theora in a Java applet
Directshow <> Java Wrapper
Fobs4JMF
JLayer MP3 library
Xuggler
Video4Linux4Java

Related

Playing h265 HEVC in a JavaFX client

I had a small JavaFX application to play some GoPro videos on a windows / linux client. In the past I had using a GoPro 4. I've downloaded the video to the client and play it from the local storage. Like this:
File file = new File("AnyVideo.MP4");
Media m = new Media(file.toURI().toString());
MediaPlayer mp = new MediaPlayer(m);
mp.setAutoPlay(true);
mediaView.setMediaPlayer(mp);
I'll try to switch to the new GoPro 6 now. But it doesn't worked as expected.
The problem is probably that the JavaFX MediaPlayer did not support the codec from the new GoPro 6.
GoPro 4: h264 AVC video codec
GoPro 6: h265 HEVC video codec
The JavaFX MediaPlayer supports only the h264 codec.
Did anyone know a way how I can play a h265 HEVC video with my JavaFX application. In the best case a solution wich can play the video immediatly from the camera without download the video first to the client. The GoPro has a smal Media Server to get the video over HTTP. as example:
http://10.5.5.9:8080/videos/DCIM/100/GPR10973.MP4
Native JavaFX Solution
Perhaps this is a duplicate or at least related to:
Adding other video codecs / DVD support to JavaFX 2.2.
See my answer to that question for links to related feature requests in the JavaFX bug tracker system.
Solutions using non-JavaFX tech from JavaFX
There are other solutions than those discussed in answers to that question which may work for you. Especially if your primary concern is just getting some kind of playback, even if it doesn't have deep integration with the JavaFX media system.
For instance, other approaches than native JavaFX playback could be:
Using VLCJ with some kind of Swing integration (such as a SwingNode, though that may or may not work).
Rendering the VLCJ video into a JavaFX ImageView or Canvas.
See related: Playing Video in Java FX using vlcj api.
Which links to the following project: https://github.com/caprica/vlcj-javafx.
Launch a native video player if you don't need the video embedded.
Perhaps Desktop.open() or the Process API could do this.
Call ffmpeg to convert h265 to h264.
I don't know much about this, but a quick google of the topic shows up references to the xuggle project.
Current status of the xuggler project is:
Xuggler is on hiatus as no one is actively developing it anymore. Sorry. That said, you can always find the source code and start hacking yourself. Good luck!
So I wish you good luck with that ;-)
Launching the native browser through a HostServices.showDocument() call to display the video.
Use a third party browsing component that can be integrated into JavaFX and includes support for the media type you want to play back, for example JxBrowser:
H.265 support in jxbrowser
Of the options outlined above, personally, I would recommend using HostServices to play the video in the native browser if that kind of solution will possibly work for you.
Going into detail on various options is probably out of scope for StackOverflow (even the above list starts looking like a sometimes frowned upon library recommendation).

JavaFX : MediaException: MEDIA_UNSUPPORTED : media type not supported

I need to play the 3gp, mov and mp4 videos in the media player. Right now I am using JavaFx media player but it supports only mp4 videos. So what I can do to play the other two formats as well in this player or is there any other solution also available for this. Any help and suggestions please?
jdk = 1.7
JavaFx: 2.1
Here is a list of JavaFX supported audio and video formats.
For anything unsupported by JavaFX, you have the option of either converting them to another format or finding a way to decode them inside your application.
There are libraries available for decoding, such as JCodec or Jffmpeg
You will need to do some further research to determine your exact requirements and which formats you will need to support. Some solutions are more difficult than others.
The supported media types can be viewed on this page: Introduction to JavaFX Media
Quoting:
Video: FLV containing VP6 video and MP3 audio; MPEG-4 multimedia container with H.264/AVC (Advanced Video Coding) video compression
What you may do is convert your videos to .flc or .mp4 and you will be able to play them with JavaFX MediaPlayer.
Related StackOverflow questions:
Adding other video codecs / DVD support to JavaFX 2.2
How to play other video formats in JavaFX

How to read and play realtime sound stream in java?

I'm using Java to read and play some real time audio streams such as the voice from radio station.
I have the real time web address like this one and it can be played in a web browser.
How can I play it using Java language?
Thanks.
MP3SPI is a Java Service Provider Interface that adds MP3 (MPEG 1/2/2.5 Layer 1/2/3) audio format support for Java Platform. It supports streaming, ID3v2 frames, Equalizer etc. It is based on JLayer and Tritonus Java libraries.
You can use this library MP3 SPI for Java Sound , and its documentation here.
Library reference

the better way to trnascode the audio and video files in java?

i am looking for api's for trans-coding the audio video files in java,
i am currently trying out the xuggler project but can't done much with this need some recommendation which will be suitable for my requirements
audio video trans-coding
bitrate and frame rate management for media files
cut and save the parts of audio and video
burn the files to cd dvd
the above operations i need to do please guide which api's will help
currently i am looking an vlcj and handbreak the open source projects.
help required

FLAC or OGG Online Media player

Is there a way to make an audio/video player in Java that can play on a website?
I searched around but I don't understand enough yet for this.
We are going to setup a server that can stream OGG and FLAC audio files. We need a player that can play them on a webpage.
Our backend is built with Java. Before we put together a project for a Java programmer I want to know what the possibilities are.
Can this be done with an applet and simply add the right codecs and place it on the webpage?
Yes, we made js flac player. This is code of js codec: https://github.com/audiocogs/flac.js
This framework https://github.com/audiocogs/aurora.js for made player
You just to embed the HTML for a player, then add your own script to play the audio/video.
Here's how to Embed the code for WMP:
http://www.mioplanet.com/rsc/embed_mediaplayer.htm
Sorry, I don't know what files it can play but just give it a shot...
Found jPlayer. HTML5 with flash fallback.

Categories