无法以高帧率播放视频

时间:2014-05-29 15:22:57

标签: java

上下文       我正在尝试在Jcreator中创建一个视频播放器,但问题是它给出了以下错误

  --------------------Configuration: newPlayer - JDK version 1.7.0_55 <Default> - <Default>--------------------
  Unable to handle format: mpeglayer3, 44100.0 Hz, 16-bit, Stereo, LittleEndian, Signed, 6000.0 frame rate, FrameSize=32768 bits
Failed to realize: com.sun.media.PlaybackEngine@15419025
Error: Unable to realize com.sun.media.PlaybackEngine@15419025
Exception in thread "main" java.lang.NullPointerException
    at newPlayer.Pla(newPlayer.java:48)
    at newPlayer.main(newPlayer.java:59)
Process completed. 




    import java.awt.*;
    import java.net.URL;
    import java.net.*;
    import java.io.*;

    public class newPlayer {
        JFrame frame;
        Player play;
        URL url;
        JFileChooser chooser;
        public void Pla()
        {
            frame=new JFrame();

            frame.setSize(1500,1500);
            frame.setLayout(new BorderLayout());
            chooser=new JFileChooser();
            int i=chooser.showOpenDialog(null);
            if(i==JFileChooser.APPROVE_OPTION);
            {
                url=null;
            }
            try
            {
            url=chooser.getSelectedFile().toURI().toURL();
            }
            catch ( MalformedURLException malformedURLException )
     {
           JOptionPane.showMessageDialog(null, "Could not create URL for the file" );
     } 
     try
     {
            play=Manager.createRealizedPlayer(url);
     }
     catch ( CannotRealizeException cannotRealizeException ){
            JOptionPane.showMessageDialog(null, "Could not realize media player.");
        } 
     catch ( IOException iOException )
     {
     JOptionPane.showMessageDialog(null,"Error reading from the source" );
     }
     catch ( NoPlayerException noPlayerException ){
            JOptionPane.showMessageDialog(null, "No media player found");
        } 

            Component view=play.getVisualComponent();
                //adds video component
            Component ctrl=play.getControlPanelComponent();
            frame.add(view,BorderLayout.CENTER);
            frame.add(ctrl,BorderLayout.SOUTH);
            frame.setVisible(true);
            play.start();

        }
        public static void main(String[]argo)
        {
            newPlayer f=new newPlayer();
            f.Pla();
        }

    }

1 个答案:

答案 0 :(得分:-1)

阅读错误讯息......

  

无法处理格式:mpeglayer3,44100.0 Hz,16位,立体声,LittleEndian,有符号,6000.0帧速率,FrameSize = 32768位

您的视频格式错误。

  

JMF.ps支持哪些视频格式

好吧,让我们试试looking it up

第一个链接带我们to a table of supported formats

相关问题