-1

I produced an rtp link with ffmpeg and I tried to listen and play this stream. VLC and ffmpeg can play rtp stream, both work well but jmf doesn't.

Although there is no any error, jmf doesn't play rtp stream and there is no sound.

My rtp stream (http:.. is a radio link and rtp:... my stream)

ffmpeg -i http://airspectrum.cdnstream1.com:8114/1648_128 -acodec copy -f rtp "rtp://127.0.0.1:10000/audio/1"

public void play() {
    MediaLocator mediaLocator = new MediaLocator("rtp://127.0.0.1:10000/audio/1");
    try {
        if (mediaLocator == null) {
            System.err.println("null locator");
        }
        player = Manager.createRealizedPlayer(mediaLocator);
        player.start();
    } catch (CannotRealizeException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (NoPlayerException e) {
        e.printStackTrace();
    }

}
  1. os ubuntu 16.08
  2. java jdk 1.8
  3. javax.media.jmf 2.1.1e (maven repo version)
Newd
  • 2,174
  • 2
  • 17
  • 31
  • Is it in one of these formats? -> http://www.oracle.com/technetwork/java/javase/formats-138492.html#RTPFormats – Fildor Jan 19 '17 at 13:37
  • i changed ffmpeg codec to mp2 (Audio: MPEG Layer I, II ) which is supported by jmf but still no voice. this was for server side (produce rtp stream). and client side i found >> Format input1 = new AudioFormat(AudioFormat.MPEG_RTP); Format output = new AudioFormat(ContentDescriptor.RAW_RTP); PlugInManager.addPlugIn("com.sun.media.codec.audio.mp3.JavaDecoder", new Format[] {input1}, new Format[] {output}, PlugInManager.CODEC ); but no changes. – ahmet burak Jan 19 '17 at 15:01
  • com.sun.media.codec.audio.mp3.Java**D‌​e**coder for output? Idk but is that right? – Fildor Jan 19 '17 at 15:04
  • yes it is right and no changes. i found this >> In the All-Java versions of JMF, video capturing is not supported, and audio capture is only supported when running on J2SE 1.3 (which has the Java Sound API bundled with it). The Direct Audio renderer and capturer are only supported on Windows. (http://www.oracle.com/technetwork/java/javase/issues-139827.html) maybe i try on windows with J2SE 1.3 not ubuntu – ahmet burak Jan 19 '17 at 15:15

1 Answers1

0

open your hosts file (nano /etc/hosts) and add your ip and user name (192.168.X.XXX username). i don't know exact reason but it worked me!