I've installed fobs4jmf 0.2 on my system (debian gnu/linux , j2sdk 1.4.2, JMF 2.1.1e). Everything's ok using jmstudio (even with the jmstudio shipped with JMF, after having registered fobs).
But I have a problem when using it embedded in an Applet (using the SimplePlayerApplet (http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/SimplePlayerApplet.java.html)) : a JMF compatible clip (e.g. MPEG 1 with PCM audio) plays correctly but a clip requiring fobs codecs (e.g. DIVX video / MP3 audio) doesn't play (and the same clip is correctly played using jmstudio). I get the following error :
Unable to handle format: DIVX, 360x288, FrameRate=25.0, Length=311040 0 extra bytes
Unable to handle format: mpeglayer3, 11025.0 Hz, 0-bit, Mono, Unsigned, 1000.0 frame rate, FrameSize=8 bits
Failed to realize: com.sun.media.PlaybackEngine@1b25a82
Error: Unable to realize com.sun.media.PlaybackEngine@1b25a82
FATAL ERROR: Failed to realize: input media not supported: DIVX video, mpeglayer3 audio
java.lang.Error: Failed to realize: input media not supported: DIVX video, mpeglayer3 audio
at EssaiApplet.Fatal(EssaiApplet.java:269)
at EssaiApplet.controllerUpdate(EssaiApplet.java:259)
at com.sun.media.BasicController.dispatchEvent(BasicController.java:1254)
at com.sun.media.SendEventQueue.processEvent(BasicController.java:1286)
at com.sun.media.util.ThreadedEventQueue.dispatchEvents(ThreadedEventQueue.java:65)
at com.sun.media.util.ThreadedEventQueue.run(ThreadedEventQueue.java:92)
I have the same error using mozilla + java plugin or the appletviewer. In both cases, fobs classes, jmf.properties and fobs libraries are in the search paths (CLASSPATH and LD_LIBRARY_PATH); JMFHOME is set.
Thanks for any help and thanks a lot for this work on fobs !
Sincerely,
Remi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
well, about your issue I can't give you a proper answer as I haven't ever try to run fobs within an applet. By looking at the error log you've sent it seems that the properties file being used is not the right one. Maybe, you will be forced to configure the codecs programatically, as explained in the JMF tutorial. Check also the JMF forums to see if there's a way to specify the properties file to use. Even if you solve this problem, you will face the shared library one.
I'm not sure whether Fobs is the right tool to use in applets or not. I will make som research and report you any results.
Cheers!
Jos San Pedro Wandelmer
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
in my applet code (and nothing else, not even trying to load plugin manually). When I run in both the appletviewer and mozilla + jre plugin, I get a plugin list which is coherent with the list showed by jmfregistry, including com.omnividea.media.codec.video.NativeDecoder and com.omnividea.media.codec.audio.NativeDecoder.
Thus, I suppose the problem is in loading the native shared library (but it's strange I get no SecurityException in this case). I'll try to figure out what's happening starting with the FOBS source code and adding System.out.println()s (I currently test with prebuilt binaries)...
For the question about the utility for Fobs in applets, I just want to give some points of interrest :
- it could be a good solution for a cross-platform, open standard media player, embeddable in HTML pages, and, thanks to Fobs, able to play e.g. streamed DivX,
- with a little work, very cool features could be added to such a player, for example synchronizations between played media and displayed HTML.
Sincerely,
Rmi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
your ideas look very interesting. I specialy like the html + video synchroniozation. Something similar can be achieved using SMIL, a w3c standard for multimedia presentations.
Anyway, I'm not sure it can be easily done. Have you considered that Fobs uses a native part? You will need to have some control to find the correct native library to send to the user. I haven't really done too much applet coding and maybe it is just an easy thing to do.
Good luck with your work!! I will tell if I find any solution for this problem.
Best regards
Jos San Pedro Wandelmer
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
SMIL is definitely the objective... But, there are still issues. The first one is the lack of players supporting SMIL integrated in everyday use web browser : many of them being standalone browsers including media (e.g. ambulant (http://www.cwi.nl/projects/Ambulant/distPlayer.html) or X-Smiles (http://www.xsmiles.org/)). Maybe the helix player (embeddable and SMIL compliant) can get new interrest since the announce of the availability of its source code in the terms of the GPL (http://linux.slashdot.org/linux/04/08/03/155212.shtml?tid=141&tid=162&tid=218&tid=106).
Fobs could be an exciting alternative, since FFMPEG codecs are more efficient and more versatile and since smarter controls and applications can be written in java. We can also imagine some SMIL support, coded in java.
I've considered the native part of Fobs, and I think that an installer can deal with its installation (putting the jar file(s) and the jmf.properties in the lib/ext directory of the jre plugin, and the shared library in the lib (or lib/i386) directory of the jre plugin), after the architecture type of the client being tested. I don't think it'd be more difficult than any other plugin.
Sincerely,
Rmi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
with a little more inspection, I discovered 2 problems :
- when I try to force the loading of the com.omnividea.media.parser.video.Parser class (with a Class.forName()), I get a SecurityException due to the System.loadLibrary() call in the static part of this class. As a workaround, I added an entry in the java.policy property file.
- my test applet then tries to play an http video stream; Fobs don't seem to play such streams. In my tests, the JMF avi demuxer is used to demux the video stream in this case (and not the Fobs' one) and then, the format of the audio and video packets are set incorrectly (mpeglayer3 audio, DIVX video, since Fobs expects FFMPEG_AUDIO and FFMPEG_VIDEO).
I didn't actually find a solution for the second problem; maybe registering formats with JMF names for every libavcodec supported codec (and having com.omnividea.media.codec.*.NativeDecoder.getSupportedInputFormats() returning this list) could help having Fobs codecs used with the JMF demuxers. An other solution could be to wrap libavformat network demuxers in Fobs.
Sincerely,
Rmi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
regarding the support of http streams it is not really implemented in the current version of Fobs. It shouldn't take much work to solve it: a little parsing of the DataSource url and calling the appropriate ffmpeg open function.
Anyway, as of Fobs 0.3pre1 I have included a preliminary test I coded before Fobs. It is a JMF codec (not Parser) that uses ffmpeg library as well. It is implemented in the class com.omnividea.media.codec.video.JavaDecoder. The class is included in the fobs4jmf.jar file and the implementation is included in the fobs4jmf.dll (or .so or .dylib) file. The only problem is that I only implemented that for video codecs. If someone find this other method to access ffmpeg from JMF useful i will consider to code the audio part as well.
Hope this helps!
Cheers
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I've installed fobs4jmf 0.2 on my system (debian gnu/linux , j2sdk 1.4.2, JMF 2.1.1e). Everything's ok using jmstudio (even with the jmstudio shipped with JMF, after having registered fobs).
But I have a problem when using it embedded in an Applet (using the SimplePlayerApplet (http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/SimplePlayerApplet.java.html)) : a JMF compatible clip (e.g. MPEG 1 with PCM audio) plays correctly but a clip requiring fobs codecs (e.g. DIVX video / MP3 audio) doesn't play (and the same clip is correctly played using jmstudio). I get the following error :
Unable to handle format: DIVX, 360x288, FrameRate=25.0, Length=311040 0 extra bytes
Unable to handle format: mpeglayer3, 11025.0 Hz, 0-bit, Mono, Unsigned, 1000.0 frame rate, FrameSize=8 bits
Failed to realize: com.sun.media.PlaybackEngine@1b25a82
Error: Unable to realize com.sun.media.PlaybackEngine@1b25a82
FATAL ERROR: Failed to realize: input media not supported: DIVX video, mpeglayer3 audio
java.lang.Error: Failed to realize: input media not supported: DIVX video, mpeglayer3 audio
at EssaiApplet.Fatal(EssaiApplet.java:269)
at EssaiApplet.controllerUpdate(EssaiApplet.java:259)
at com.sun.media.BasicController.dispatchEvent(BasicController.java:1254)
at com.sun.media.SendEventQueue.processEvent(BasicController.java:1286)
at com.sun.media.util.ThreadedEventQueue.dispatchEvents(ThreadedEventQueue.java:65)
at com.sun.media.util.ThreadedEventQueue.run(ThreadedEventQueue.java:92)
I have the same error using mozilla + java plugin or the appletviewer. In both cases, fobs classes, jmf.properties and fobs libraries are in the search paths (CLASSPATH and LD_LIBRARY_PATH); JMFHOME is set.
Thanks for any help and thanks a lot for this work on fobs !
Sincerely,
Remi
Hi Remi,
well, about your issue I can't give you a proper answer as I haven't ever try to run fobs within an applet. By looking at the error log you've sent it seems that the properties file being used is not the right one. Maybe, you will be forced to configure the codecs programatically, as explained in the JMF tutorial. Check also the JMF forums to see if there's a way to specify the properties file to use. Even if you solve this problem, you will face the shared library one.
I'm not sure whether Fobs is the right tool to use in applets or not. I will make som research and report you any results.
Cheers!
Jos San Pedro Wandelmer
Hi,
thanks for your answer Jos.
Starting with your advice, I tried to investigate further to see if the right jmf.properties was loaded. So I add a
Vector plugins = PlugInManager.getPlugInList(null, null, PlugInManager.CODEC);
System.out.println("plugin codecs => " + plugins);
in my applet code (and nothing else, not even trying to load plugin manually). When I run in both the appletviewer and mozilla + jre plugin, I get a plugin list which is coherent with the list showed by jmfregistry, including com.omnividea.media.codec.video.NativeDecoder and com.omnividea.media.codec.audio.NativeDecoder.
Thus, I suppose the problem is in loading the native shared library (but it's strange I get no SecurityException in this case). I'll try to figure out what's happening starting with the FOBS source code and adding System.out.println()s (I currently test with prebuilt binaries)...
For the question about the utility for Fobs in applets, I just want to give some points of interrest :
- it could be a good solution for a cross-platform, open standard media player, embeddable in HTML pages, and, thanks to Fobs, able to play e.g. streamed DivX,
- with a little work, very cool features could be added to such a player, for example synchronizations between played media and displayed HTML.
Sincerely,
Rmi
Hi Remi,
your ideas look very interesting. I specialy like the html + video synchroniozation. Something similar can be achieved using SMIL, a w3c standard for multimedia presentations.
Anyway, I'm not sure it can be easily done. Have you considered that Fobs uses a native part? You will need to have some control to find the correct native library to send to the user. I haven't really done too much applet coding and maybe it is just an easy thing to do.
Good luck with your work!! I will tell if I find any solution for this problem.
Best regards
Jos San Pedro Wandelmer
Hi Jos,
SMIL is definitely the objective... But, there are still issues. The first one is the lack of players supporting SMIL integrated in everyday use web browser : many of them being standalone browsers including media (e.g. ambulant (http://www.cwi.nl/projects/Ambulant/distPlayer.html) or X-Smiles (http://www.xsmiles.org/)). Maybe the helix player (embeddable and SMIL compliant) can get new interrest since the announce of the availability of its source code in the terms of the GPL (http://linux.slashdot.org/linux/04/08/03/155212.shtml?tid=141&tid=162&tid=218&tid=106).
Fobs could be an exciting alternative, since FFMPEG codecs are more efficient and more versatile and since smarter controls and applications can be written in java. We can also imagine some SMIL support, coded in java.
I've considered the native part of Fobs, and I think that an installer can deal with its installation (putting the jar file(s) and the jmf.properties in the lib/ext directory of the jre plugin, and the shared library in the lib (or lib/i386) directory of the jre plugin), after the architecture type of the client being tested. I don't think it'd be more difficult than any other plugin.
Sincerely,
Rmi
You should be able to make JNI calls in your applet as long as the applet is properly signed and accepted by the client:
http://java.sun.com/docs/books/tutorial/security1.2/sigcert/index.html
Hi,
with a little more inspection, I discovered 2 problems :
- when I try to force the loading of the com.omnividea.media.parser.video.Parser class (with a Class.forName()), I get a SecurityException due to the System.loadLibrary() call in the static part of this class. As a workaround, I added an entry in the java.policy property file.
- my test applet then tries to play an http video stream; Fobs don't seem to play such streams. In my tests, the JMF avi demuxer is used to demux the video stream in this case (and not the Fobs' one) and then, the format of the audio and video packets are set incorrectly (mpeglayer3 audio, DIVX video, since Fobs expects FFMPEG_AUDIO and FFMPEG_VIDEO).
I didn't actually find a solution for the second problem; maybe registering formats with JMF names for every libavcodec supported codec (and having com.omnividea.media.codec.*.NativeDecoder.getSupportedInputFormats() returning this list) could help having Fobs codecs used with the JMF demuxers. An other solution could be to wrap libavformat network demuxers in Fobs.
Sincerely,
Rmi
Hi Rmi,
regarding the support of http streams it is not really implemented in the current version of Fobs. It shouldn't take much work to solve it: a little parsing of the DataSource url and calling the appropriate ffmpeg open function.
Anyway, as of Fobs 0.3pre1 I have included a preliminary test I coded before Fobs. It is a JMF codec (not Parser) that uses ffmpeg library as well. It is implemented in the class com.omnividea.media.codec.video.JavaDecoder. The class is included in the fobs4jmf.jar file and the implementation is included in the fobs4jmf.dll (or .so or .dylib) file. The only problem is that I only implemented that for video codecs. If someone find this other method to access ffmpeg from JMF useful i will consider to code the audio part as well.
Hope this helps!
Cheers