Search code examples
javaffmpegstreamrtpjmf

why jmf can't play rtp stream?


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)

Solution

  • 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!