Menu

Unable to handle format: FFMPEG_AUDIO

user
Jay Dub
2009-09-02
2013-05-09
  • Jay Dub

    Jay Dub - 2009-09-02

    Hi guys, I'm not sure what I'm doing wrong here. I'm migrating a Swing project in Netbeans to SWT in Eclipse. I get this error when attempting to play an .avi file. The video shows but no sound.

    Unable to handle format: FFMPEG_AUDIO

    This file plays when I'm using netbeans, just not in eclipse. I know fobs is installed as I can use the JMStudio to plays the file perfectly with sound. File also plays with sound in Netbeans.

    In the Java Build Path in eclipse I've added the following:
    fobs\jmf.jar
    fobs\fobs4jmf.jar
    fobs\ fobs\fobs4jmf.dll
    JRE1.6

    In Netbeans I have the following in my libraries...
    fobs\ fobs4jmf.jar
    jmf.jar
    JDK1.6

    Any ideas?

     
    • Jerry West

      Jerry West - 2009-09-09

      Hey man, I have got the same problem  Unable to handle format: FFMPEG_AUDIO when I play any video format (image is ok). In addition I cannot play mp3 music only files. To cap it all  everything is ok when I launch this crap from eclipse (I can run any format - divx and the rest). I am almost sure that this is problem of classpath and conflict between jmf.properties.
      I am also sure that this is not problem of audio compress. support because first of all it is ok in eclipse and  second when playing the file I can see this sound icon in JMStudio so it means that audio format is supported (otherwise it would disapear).
      I have not found solution so far but if any good soul is able to help I would be most happy. 

       
    • umjammer

      umjammer - 2009-09-09

      Hi,
      I can solve this problem changing the order of audio renderers using jmfregistry.
      I ordered "com.sun.media.renderer.audio.JavaSoundRenderer" class at first.

      Env.
      Mac 0S X 10.6
      java version "1.6.0_15"
      Java(TM) SE Runtime Environment (build 1.6.0_15-b03-219)
      Java HotSpot(TM) 64-Bit Server VM (build 14.1-b02-90, mixed mode)
      Fobs4jmf 4.0 (modified)

       
    • Jerry West

      Jerry West - 2009-09-09

      HEAR YE
      I GOT IT.
      As I mentioned it worked fine in Eclipse but no as app.
      I have been working with this shit (most of time I was crying)  and I came up with this code. It is based on some method I found in net but I have added some new things. It registers codecs and rendereres from code - no messing with register is required. It assumes that you have DirectAudio renderer from  Sun pack - (as explain by fobs fix sound in win tutorial ) . It also uses jffmpeg. You can get it from source forge. Some may find this overkill because it uses both fobs and ffmpeg but frankly speaking I wound not dare to delete any line of this code. Just try it. It enabled sound in my java app. If you optimize it drop me a line.
         

          private boolean isFobsInited(Vector rendList){
              String rname = null;
              for (int i = 0; i < rendList.size(); i++) {
                  rname = (String) (rendList.elementAt(i));
                  if (rname.equals("org.llama.jmf.ByteBufferRenderer")) {
                      return true;
                  }
              }
              return false;
          }
        
          private void InitFobs(){
              Vector rendererlist=PlugInManager.getPlugInList(null,null,PlugInManager.RENDERER);
              if(isFobsInited(rendererlist))return;
              Format[] ffmpegformat = new VideoFormat[] { new VideoFormat("FFMPEG_VIDEO") };
              Format[] ffmpegdesc = new ContentDescriptor[] {new ContentDescriptor("video.ffmpeg")};
              Format[] ffmpegaudio = new Format[] { new AudioFormat("FFMPEG_AUDIO") };
              Format[] ffmpegaudiodesc = new ContentDescriptor[] {new ContentDescriptor("audio.ffmpeg")};
             
              Format[] supportedInputFormats = new VideoFormat[] {
                 new VideoFormat("iv31"), //CODEC_ID_INDEO3
                  new VideoFormat("iv32"),
                
                  new VideoFormat("msvc"), //CODEC_ID_MSVIDEO1
                  new VideoFormat("cram"),
                  new VideoFormat("wham"),
                
                  new VideoFormat("wmv1"), //CODEC_ID_WMV1
                
                  new VideoFormat("wmv2"), //CODEC_ID_WMV2
                
                  new VideoFormat("mpeg"), //CODEC_ID_MPEG1VIDEO
                  new VideoFormat("mpg1"),
                  new VideoFormat("mpg2"),
                  new VideoFormat("pim1"),
                  new VideoFormat("vcr2"),
                
                  new VideoFormat("mjpa"), //CODEC_ID_MJPEG
                  new VideoFormat("mjpb"),
                  new VideoFormat("mjpg"),
                  new VideoFormat("ljpg"),
                  new VideoFormat("jpgl"),
                  new VideoFormat("avdj"),
                
                  new VideoFormat("svq1"), //CODEC_ID_SVQ1
                  new VideoFormat("svqi"),
                
                  new VideoFormat("svq3"), //CODEC_ID_SVQ3
                
                  new VideoFormat("mp4v"), //CODEC_ID_MPEG4
                  new VideoFormat("divx"),
                  new VideoFormat("dx50"),
                  new VideoFormat("xvid"),
                  new VideoFormat("mp4s"),
                  new VideoFormat("m4s2"),
                  new VideoFormat("div1"),
                  new VideoFormat("blz0"),
                  new VideoFormat("ump4"),
                
                
                  new VideoFormat("h264"), //CODEC_ID_H264
                
                  new VideoFormat("h263"), //CODEC_ID_H263
                
                  new VideoFormat("u263"), //CODEC_ID_H263P
                  new VideoFormat("viv1"),
                
                  new VideoFormat("i263"), //CODEC_ID_i263
                
                  new VideoFormat("dvc"), //CODEC_ID_DVVIDEO
                  new VideoFormat("dvcp"),
                  new VideoFormat("dvsd"),
                  new VideoFormat("dvhs"),
                  new VideoFormat("dvs1"),
                  new VideoFormat("dv25"),
                
                
                  new VideoFormat("vp31"), //CODEC_ID_VP3
                
                  new VideoFormat("rpza"), //CODEC_ID_RPZA
                
                  new VideoFormat("cvid"), //CODEC_ID_CINEPAK
                
                  new VideoFormat("smc"), //CODEC_ID_SMC
                
                
                  new VideoFormat("mp42"), // CODEC_ID_MSMPEG4V2
                  new VideoFormat("div2"),
                
                  new VideoFormat("mpg4"), // CODEC_ID_MSMPEG4V1
                
                  new VideoFormat("div3"), // CODEC_ID_MSMPEG4V3
                  new VideoFormat("mp43"),
                  new VideoFormat("mpg3"),
                  new VideoFormat("div5"),
                  new VideoFormat("div6"),
                  new VideoFormat("div4"),
                  new VideoFormat("ap41"),
                  new VideoFormat("col1"),
                  new VideoFormat("col0"),
                  new VideoFormat("vob"),
                 new VideoFormat("ogg")
                
              };
              Format[] frgb = new VideoFormat[] {new RGBFormat()};
              Format[] alinear=new AudioFormat[]{new AudioFormat("LINEAR")};
              //registre le renderer
              PlugInManager.addPlugIn("org.llama.jmf.ByteBufferRenderer",frgb,null,PlugInManager.RENDERER);
              Vector plist=PlugInManager.getPlugInList(null,null,PlugInManager.RENDERER);
              //move the plugin to the top of the list
              Object last=plist.lastElement();
              plist.insertElementAt(last,0);
              plist.remove(plist.lastIndexOf(last));
              //REMOVE
              PlugInManager.removePlugIn("com.sun.media.renderer.audio.JavaSoundRenderer", PlugInManager.RENDERER);
                PlugInManager.removePlugIn("com.sun.media.renderer.audio.SunAudioRenderer", PlugInManager.RENDERER);
              
              
              
              PlugInManager.setPlugInList(plist,PlugInManager.RENDERER);
              // try{PlugInManager.commit();}catch(Exception e){e.printStackTrace();};
              System.out.println("RENDERER\n"+plist.toString());
              //registre le demultiplexer
            
              /*PlugInManager.addPlugIn("com.omnividea.media.parser.video.Parser",
                      ffmpegformat,
                      null,
                      PlugInManager.DEMULTIPLEXER);   */
            
              Format[] In;
              Format[] Out;
              In=ffmpegdesc;
              Out=alinear;
              PlugInManager.addPlugIn("com.omnividea.media.parser.video.Parser",
                      In,
                      Out,
                      PlugInManager.DEMULTIPLEXER);
              //FF
              In=ffmpegdesc;
              Out=alinear;
              PlugInManager.addPlugIn("net.sourceforge.jffmpeg.demux.vob.VobDemux",
                      In,
                      Out,
                      PlugInManager.DEMULTIPLEXER);
              PlugInManager.addPlugIn("net.sourceforge.jffmpeg.demux.ogg.OggDemux",
                      In,
                      Out,
                      PlugInManager.DEMULTIPLEXER);
             
             
             
              plist=PlugInManager.getPlugInList(null,null,PlugInManager.DEMULTIPLEXER);
              System.out.println("DEMULTIPLEXER\n"+plist.toString());
              
            
            
              //AUDIO
              In=ffmpegaudio;
              Out=alinear;
              PlugInManager.addPlugIn("com.sun.media.renderer.audio.JavaSoundRenderer",
                      In,
                      Out,
                      PlugInManager.RENDERER);
              In=ffmpegaudio;
              Out=null;
              PlugInManager.addPlugIn("com.sun.media.renderer.audio.SunAudioRenderer",
                      In,
                      Out,
                      PlugInManager.RENDERER);
                      
              In=ffmpegaudio;
              Out=null;
              PlugInManager.addPlugIn("com.sun.media.renderer.audio.DirectAudioRenderer",
                      In,
                      Out,
                      PlugInManager.RENDERER);
           
             
              
            
           
              //registre les codecs
              In=ffmpegformat;
              Out=frgb;
              PlugInManager.addPlugIn("com.omnividea.media.codec.video.NativeDecoder",
                      In,
                      Out,
                      PlugInManager.CODEC);
            
              In=ffmpegaudio;
              Out=alinear;
            
              PlugInManager.addPlugIn("com.omnividea.media.codec.audio.NativeDecoder",
                      In,
                      Out,
                      PlugInManager.CODEC);
            
              //PlugInManager.addPlugIn("com.omnividea.media.codec.video.JavaDecoder",supportedInputFormats,defaultOutputFormats,PlugInManager.CODEC);
              In=supportedInputFormats;
              Out=frgb;
              PlugInManager.addPlugIn("com.omnividea.media.codec.video.JavaDecoder",
                      In,
                      Out,
                      PlugInManager.CODEC);
              plist=PlugInManager.getPlugInList(null,null,PlugInManager.CODEC);
             
              //FF
              In=supportedInputFormats;
              Out=frgb;
              PlugInManager.addPlugIn("net.sourceforge.jffmpeg.VideoDecoder",
                      In,
                      Out,
                      PlugInManager.CODEC);
              PlugInManager.addPlugIn("net.sourceforge.jffmpeg.AudioDecoder",
                      In,
                      Out,
                      PlugInManager.CODEC);
                     
                     
              plist=PlugInManager.getPlugInList(null,null,PlugInManager.CODEC);
             
              System.out.println("CODECS\n"+plist.toString());
            
              //registre le package
              Vector  packagePrefix = PackageManager.getProtocolPrefixList();
              String myPackagePrefix = new String("com.omnividea");
              packagePrefix.add(0,myPackagePrefix);
              PackageManager.setProtocolPrefixList(packagePrefix);
            
              System.out.println(PackageManager.getProtocolPrefixList().toString());
               try{PlugInManager.commit();}catch(Exception e){e.printStackTrace();};
              
               //PO zmianach
               plist=PlugInManager.getPlugInList(null,null,PlugInManager.RENDERER);
               System.out.println("RENDERER\n"+plist.toString());
               plist=PlugInManager.getPlugInList(null,null,PlugInManager.DEMULTIPLEXER);
               System.out.println("DEMULTIPLEXER\n"+plist.toString());
               plist=PlugInManager.getPlugInList(null,null,PlugInManager.CODEC);
               System.out.println("CODECS\n"+plist.toString());
             
              return;
          }
         
      Naturally you can delete Systems. This method should be called constructor like this
      public JMStudio () {
              super ( null, APPNAME );
              updateMenu ();
              InitFobs();
          }
      Assuming you have got JMStudio.jar (built from source with no changes - except for above Init) and rest of jars - Fobs4jmf.jar , Fobs4jmf .dll,  jffmpeg-1.1.0.jar,jmf.jar
      I call app in command line like this: java -classpath JMStudio.jar, jmf.jar; Fobs4jmf.jar JMStudio . Dont add any jmf.properties in any jar.

      Questions ?

       
  •  Tyoma

    Tyoma - 2010-01-10

    Actually you don't need to include dll in java class path. you need just to place it to corresponding directory of your OS, for example on windows it goes to windows/system32

    Read about manual installation here: http://fobs.sourceforge.net/f4jmf_first.html (the very bottom part)

    It works fine for my app in both Eclipse Classic and Eclipse EE…

     

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.