Search code examples
javaaudiojmf

JMF Unable to handle format


After lot of struggling with installation of JMF and jffmpeg i managed to open and play .avi file in JMStudio. When i try to open the same file in my own test code, video works fine, but audio does not work. What is reason for this behavior? I know that JMF is outdated, but all other libraries i found were either not documented very well or not free. Any tips on good and up-to-date alternatives for JMF are appreciated too.

Error message:

Unable to handle format: mpeglayer3, 48000.0 Hz, 0-bit, Stereo, Unsigned, 
  14456.0 frame rate, FrameSize=9216 bits

Code:

public class Main {     
public static void main(String args[]) throws Exception {
    DataSource ds=Manager.createDataSource(new URL("locationOfFile"));
    Player p=Manager.createRealizedPlayer(ds);
    System.out.println(ds.getContentType());
    JFrame jf=new JFrame();
    jf.add(p.getControlPanelComponent());
    jf.add(p.getVisualComponent());
    jf.setVisible(true);
    jf.pack();
}

}


Solution

  • Try VLC-J
    Also as @Andrew said, try playing the file in a standard media player first