Menu

fobs4jmf and mediaplayer bean

user
2005-02-21
2013-05-09
  • Daniel Moldovan

    Daniel Moldovan - 2005-02-21

    hi to everyone!

    I'm trying to use fobs with the MediaPlayer bean from Sun. But I get an error and only the sound is ok. I also printed the codecs and the format:

    plugin codecs:
    .........................................
    com.omnividea.media.codec.video.NativeDecoder, com.omnividea.media.codec.audio.NativeDecoder]

    SupportedInputFormats: FFMPEG_VIDEO
    Fobs4JMF - Native shared library found
    OpenError: File open error
      Unable to handle format: DX50, 640x480, FrameRate=25.0, Length=1843200 0 extra bytes

    Can anyone tell me how to make it work? The same movie is well played by "Fobs_jmstudio.exe". The idea is that I want to have a media player in my java application. I use a simple code:

    public static void main(String[] args) {
            JFrame frame = new JFrame();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            Container contentPane = frame.getContentPane();
            contentPane.setLayout(new BorderLayout());
            frame.setSize(640, 480);
            MediaPlayer mediaPlayer = new MediaPlayer();
            contentPane.add(mediaPlayer);
            frame.setVisible(true);

            Vector plugins = PlugInManager.getPlugInList(null, null, PlugInManager.CODEC);
            System.out.println("plugin codecs: " + plugins);

            Format[] inputFormats = PlugInManager.getSupportedInputFormats("com.omnividea.media.codec.video.NativeDecoder", PlugInManager.CODEC);
            for (int i = 0; i < inputFormats.length; i++) {
                Format inputFormat = inputFormats[i];
                System.out.println(inputFormat.toString());
            }

            mediaPlayer.setMediaLocator(new MediaLocator("file:/C:\\dump\\cool\\Baginski-Fallen-Art.avi"));
            mediaPlayer.start();
        }
    }

    Thanks,

    Daniel

     
    • Jose San Pedro

      Jose San Pedro - 2005-02-21

      Hi,

      I think this is again the windows namepaths issue (damn windows paths! ;)

      Try changing this line
      mediaPlayer.setMediaLocator(new MediaLocator("file:/C:\\dump\\cool\\Baginski-Fallen-Art.avi"));

      with

      mediaPlayer.setMediaLocator(new MediaLocator("file:c/dump/cool/Baginski-Fallen-Art.avi"));

      If it doesn't solve your problem, try to ensure that the jmf.properties file used by the bean is the same as the one used by Fobs-JMStudio.

      Cheers.

      Jose San Pedro

       
      • Nobody/Anonymous

        Hi Jose San Pedro and Moldoe
        First, i'd like to say that i'm working on a project in which fobs4jmf seems to be the perfect answer, so keep being sure that your product is great!!

        Well, the reason why i'm disturbing you is that I have a quite similar error than moldoe and I think that this topic can be more developped: I want to play formats that are not handled by the "basic" JMF (among which: mp4 and mov files) in a JMF based application I just developped and that works very well (for what i need at least) with MPEG files.

        So, logically I discovered fobs thanks to google, I downloaded the windows version and followed the instructions to run JMStudio (the right dll at the right place, the right path, ...). Then I ran it, and I jumped in the air since I was playing my mp4 and mov files :D

        From this time, I decided to include the fobs plugin in my application. I create a MediaPlayer from a MediaLocator.  Here is a part of my code (that works well with mpeg files):

                    ClassLoader cl = this.getClass().getClassLoader();
                   
                    jmfPlayer = (MediaPlayer)Beans.instantiate(cl, "javax.media.bean.playerbean.MediaPlayer");
                    //super.getSrcName() gets the file full path       
                    MediaLocator ml = new MediaLocator(new File(super.getSrcName()).toURL());
                   
                    jmfPlayer.setMediaLocator(ml);
                   
                    Frame f = null;
                   
                    jmfPlayer.addControllerListener(new VideoListener(this));
                    jmfPlayer.setBounds(x, y, width, height);
                    jmfPlayer.setPlaybackLoop(false);
                    jmfPlayer.realize();
                    jmfPlayer.waitForState(MediaPlayer.Realized);
                   
                    jmfPlayer.prefetch();
                    jmfPlayer.waitForState(Controller.Prefetched);

        Thanks to different helps (API, JMStudio source code, that is very instructive) I think i've developped a code that shoud work, since the method getPlugInList() of PlugInManager returns me the 2 demultiplexers and the 3 codecs of omnividea (the ones included by the JMFRegistry).

        Now the error I get is similar to moldoe's one. For a mov file, when I do "jmfPlayer.setMediaLocator(ml);" i get:

        Fobs4JMF - Native shared library found
        OpenError: File open error

        Then when I do "jmfPlayer.realize();" i get a big output :

        Fobs4JMF - Native shared library found
        Little Endian
        AVCODEC: Constructor
        AVCODEC: setInputFormat
        AVCODEC: setInputFormat
        AVCODEC: getMatchingOutputFormats
        AVCODEC: getMatchingOutputFormats
        AVCODEC: setInputFormat
        AVCODEC: getMatchingOutputFormats
        AVCODEC: open
        AVCODEC: init_decoding
          Unable to handle format: SVQ3, 720x576, FrameRate=25.0, Length=33234
        Failed to realize: com.sun.media.PlaybackEngine@d24e3f
        Error: Unable to realize com.sun.media.PlaybackEngine@d24e3f
        Failed to realize: input media not supported: SVQ3 video

        I've been working on this error for long, checking plugins, i couldn't find the reason. The only clue i have is this jmf.properties file that i don't know how to use form my source code. For myself, the problem is not a name path issue, since it works with other file types.

        I hope the answer is simple and that i did a stupid mistake!

        Regards,
        Sebastien

         
    • Nobody/Anonymous

      I have the same problem!
      If anyone could help us, pleaaaaase
      Cyril

       
      • Jose San Pedro

        Jose San Pedro - 2005-04-21

        Hi,

        I'll have a look at it tomorrow. Meanwhile, please tell me which version of Fobs are you using. Please tell me also which formats seem to be giving that problem (mpeg works fine, doesn't it?).

        Cheers!

        Jose San Pedro

         
    • Nobody/Anonymous

      Hi,
      thx for your answer. I'm actually using fobs4jmf 0.3 for windows and JMF 2.1.1.
      The problematic formats are .mov and .mp4, mpeg works fine.
      My worst frustration is that everything works fine with JMStudio :'(

      Regards,
      Sebastien

       
    • Jose San Pedro

      Jose San Pedro - 2005-04-24

      Hi,

      after a few tests I came to the conclussion it is still a path problem. I tried the following path format and it works with the code you have provided:

      "file:" + drive_name + ":" + "/path1/path2/.../file.ext"

      When fobs datasource is not able to find the file specified by this path, then JMStudio uses its own datasources to locate the file (and actually it is able to find it). At this point, fobs is not really used to play the files but jmf own classes are in charge of that. That's the reason why some files will play while others won't.

      It seems Fobs datasource will need a patch for this issue, though I hope this temporal solution is ok for you!

      Cheers!

      Jose San Pedro

       
    • Nobody/Anonymous

      Dammit!!!!

      You are damn right, i had a "/" after "file:" and now it works without it :D :D

      I'm sorry i didn't read well the topic before, but i was trusting the method File.toUrl() for giving me the complete expression but that method adds a /. I think you may have interest to implement this issue indeed cause it may give a wrong negative image of fobs :p.

      Thank you very much for your answer, and keep on developping this great product!!

      Sebastien

       
    • Nobody/Anonymous

      Hi, after having celebrated the .mov that work, I'm coming back with a couple of other questions!
      I just noticed that the loading time was longer for .mov than for mpg movies. After checking on my console, I saw :

      Fobs4JMF - Native shared library found
      237.792First Position: 0, 66 Duration: 237791
      OpenError: Not initialized

      Thx to eclipse debug mode, i saw that the method realize() of MediaPlayer was the source of this OpenError. The result is that the start() method works but is longer to execute, which is problematic for me.

      Moreover, I have seen 2 limitations of JMStudio for quicktime files : there is no sound (audio codec not found) on BMW videos (you know, the ads they did,
      among which the one with guy richie and madonna) and one matrix reloaded teaser even makes the program terminate, for a problem with a dll file: MSVCRT.dll. If you want, I'll give you the entire error message, which is pretty long and violent!! I have these problems in my program and in JMStudio.

      Regards,
      Sebastien

       
    • Jose San Pedro

      Jose San Pedro - 2005-04-25

      Hi Sebastien,

      thanks for the report. I don't have much time now for Fobs, though maybe I will take a look at it sometime next weekend. About the audio, there's really nothing I can do about it. Fobs relies in ffmpeg library to decode a/v streams. If you cannot hear any sound, that's likely to be a missing codec problem.

      About the error message, I don't think it will lead us to anything if you post it. It would be really better to have the original video causing the issue. Some deeper debugging and information about it would be really useful.

      Cheers!

      Jose San Pedro

       
    • Nobody/Anonymous

      Hi Jose,
      here is a link to the "JMF-killer" video. It's a .mov inside a zip : http://whatisthematrix.warnerbros.com/mov/reloaded_teaser_1_1024.zip

      BTW, are you aware of the problem I asked you in my last post : there is a problem with the realize() method of MediaPlayer on .mov files, it says OpenError: Not initialized, and it makes the start() method longer to work.

      Best regards,
      Sebastien

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.