Exporting a QuickTime movie with Ruby-Processing
I'm using Ruby-Processing to make a Processing app. How do I export a QuickTime movie of my app?
I've tried the following:
load_library 'video'
import 'processing.video.MovieMaker'
def setup
# stuff...
@mm = MovieMaker.new(WIDTH, HEIGHT, "drawing.mov", 30, MovieMaker.H263, MovieMaker.HIGH)
end
def draw
# stuff...
@mm.add_frame
end
def mouse_pressed
@mm.finish_movie
end
But this doesn't seem to work, and I get this error:
java.lang.reflect.InvocationTargetException
at java.awt.EventQueue.invokeAndWait(EventQueue.java:1078)
at quicktime.QTSession.<clinit>(QTSession.java:94)
at quicktime.util.QTUtils.<clinit>(QTUtils.java:33)
at processing.video.MovieMaker.<clinit>(MovieMaker.java:110)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.jruby.javasupport.JavaSupport.loadJavaClass(JavaSupport.java:147)
at org.jruby.javasupport.JavaSupport.loadJavaClassVerbose(JavaSupport.java:156)
at org.jruby.javasupport.JavaClass.forNameVerbose(JavaClass.java:944)
at org.jruby.javasupport.JavaClass.for_name(JavaClass.java:956)
at org.jruby.javasupport.Java.get_proxy_class(Java.java:445)
at org.jruby.javasupport.JavaUtilities.get_proxy_class(JavaUtilities.java:34)
at org.jruby.javasupport.JavaUtilities$s_method_1_0$RUBYINVOKER$get_proxy_class.call(org/jruby/javasupport/JavaUtilities$s_method_1_0$RUBYINVOKER$get_proxy_class.gen)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:310)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:149)
at org.jruby.ast.CallOneArgNode.interpret(CallOneArgNode.java:57)
at org.jruby.ast.ConstDeclNode.interpret(ConstDeclNode.java:97)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.RootNode.interpret(RootNode.java:129)
at org.jruby.evaluator.ASTInterpreter.evalSimple(ASTInterpreter.java:149)
at org.jruby.RubyObject.evalUnder(RubyObject.java:435)
at org.jruby.RubyObject.specificEval(RubyObject.java:414)
at org.jruby.RubyModule.module_eval(RubyModule.java:2112)
at org.jruby.RubyModule$i_method_multi$RUBYFRAMEDINVOKER$module_eval.call(org/jruby/RubyModule$i_method_multi$RUBYFRAMEDINVOKER$module_eval.gen)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroOrOneOrTwoOrThreeOrNBlock.call(JavaMethod.java:293)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:350)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:229)
at org.jruby.ast.FCallThreeArgNode.interpret(FCallThreeArgNode.java:40)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.IfNode.interpret(IfNode.java:117)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.runtime.InterpretedBlock.evalBlockBody(InterpretedBlock.java:317)
at org.jruby.runtime.InterpretedBlock.yield(InterpretedBlock.java:268)
at org.jruby.runtime.Block.yield(Block.java:194)
at org.jruby.RubyArray.eachCommon(RubyArray.java:1635)
at org.jruby.RubyArray.each(RubyArray.java:1642)
at org.jruby.RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$each.call(org/jruby/RubyArray$i_method_0_0$RUBYFRAMEDINVOKER$each.gen)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:300)
at org.jruby.runtime.callsite.CachingCallSite.callBlock(CachingCallSite.java:118)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:123)
at org.jruby.ast.CallNoArgBlockNode.interpret(CallNoArgBlockNode.java:64)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:192)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:177)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:320)
at org.jruby.runtime.callsite.CachingCallS开发者_C百科ite.callBlock(CachingCallSite.java:158)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:163)
at org.jruby.ast.FCallSpecialArgBlockPassNode.interpret(FCallSpecialArgBlockPassNode.java:38)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:112)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:135)
at org.jruby.internal.runtime.methods.AliasMethod.call(AliasMethod.java:101)
at org.jruby.runtime.callsite.SuperCallSite.cacheAndCall(SuperCallSite.java:267)
at org.jruby.runtime.callsite.SuperCallSite.callBlock(SuperCallSite.java:50)
at org.jruby.runtime.callsite.SuperCallSite.call(SuperCallSite.java:55)
at org.jruby.ast.SuperNode.interpret(SuperNode.java:111)
at org.jruby.ast.ReturnNode.interpret(ReturnNode.java:88)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.IfNode.interpret(IfNode.java:117)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:173)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:169)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:310)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:149)
at org.jruby.ast.FCallOneArgNode.interpret(FCallOneArgNode.java:36)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.evaluator.ASTInterpreter.evalClassDefinitionBody(ASTInterpreter.java:196)
at org.jruby.ast.ClassNode.interpret(ClassNode.java:141)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.RootNode.interpret(RootNode.java:129)
at org.jruby.evaluator.ASTInterpreter.evalSimple(ASTInterpreter.java:149)
at org.jruby.RubyObject.evalUnder(RubyObject.java:435)
at org.jruby.RubyObject.specificEval(RubyObject.java:414)
at org.jruby.RubyModule.module_eval(RubyModule.java:2112)
at org.jruby.RubyModule$i_method_multi$RUBYFRAMEDINVOKER$module_eval.call(org/jruby/RubyModule$i_method_multi$RUBYFRAMEDINVOKER$module_eval.gen)
at org.jruby.internal.runtime.methods.JavaMethod$JavaMethodZeroOrOneOrTwoOrThreeOrNBlock.call(JavaMethod.java:293)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:350)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:229)
at org.jruby.ast.CallThreeArgNode.interpret(CallThreeArgNode.java:61)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.ast.IfNode.interpret(IfNode.java:119)
at org.jruby.ast.NewlineNode.interpret(NewlineNode.java:104)
at org.jruby.ast.BlockNode.interpret(BlockNode.java:71)
at org.jruby.internal.runtime.methods.InterpretedMethod.call(InterpretedMethod.java:136)
at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:153)
at org.jruby.runtime.callsite.CachingCallSite.cacheAndCall(CachingCallSite.java:290)
at org.jruby.runtime.callsite.CachingCallSite.call(CachingCallSite.java:109)
at usr.local.lib.ruby.gems.$1_dot_9_dot_1.gems.ruby_minus_processing_minus_1_dot_0_dot_9.lib.ruby_minus_processing.runners.run.__file__(run.rb:7)
at usr.local.lib.ruby.gems.$1_dot_9_dot_1.gems.ruby_minus_processing_minus_1_dot_0_dot_9.lib.ruby_minus_processing.runners.run.load(run.rb)
at org.jruby.Ruby.runScript(Ruby.java:628)
at org.jruby.Ruby.runNormally(Ruby.java:550)
at org.jruby.Ruby.runFromMain(Ruby.java:396)
at org.jruby.Main.run(Main.java:272)
at org.jruby.Main.run(Main.java:117)
at org.jruby.Main.main(Main.java:97)
Caused by: java.lang.UnsatisfiedLinkError: /System/Library/Java/Extensions/libQTJNative.jnilib: no suitable image found. Did find: /System/Library/Java/Extensions/libQTJNative.jnilib: no matching architecture in universal wrapper
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1827)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1716)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1045)
at quicktime.QTSession$1.run(QTSession.java:96)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:677)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:638)
at java.awt.EventQueue$1.run(EventQueue.java:636)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:647)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Exception in thread "Animation Thread" quicktime/QTSession.java:-2:in `Gestalt': java.lang.UnsatisfiedLinkError: quicktime.QTSession.Gestalt(I[I)S (NativeException)
from quicktime/QTSession.java:935:in `gestalt'
from quicktime/QTSession.java:641:in `open'
from quicktime/QTSession.java:608:in `open'
from processing/video/MovieMaker.java:199:in `<init>'
from processing/video/MovieMaker.java:162:in `<init>'
from sun/reflect/NativeConstructorAccessorImpl.java:-2:in `newInstance0'
from sun/reflect/NativeConstructorAccessorImpl.java:39:in `newInstance'
from sun/reflect/DelegatingConstructorAccessorImpl.java:27:in `newInstance'
from java/lang/reflect/Constructor.java:513:in `newInstance'
from org/jruby/javasupport/JavaConstructor.java:243:in `newInstanceDirect'
from my-processing-app.rb:245:in `new_proxy'
from my-processing-app.rb:261:in `setup'
from :1
...internal jruby stack elided...
from quicktime.QTSession.gestalt(QTSession.java:935)
from quicktime.QTSession.open(QTSession.java:641)
from quicktime.QTSession.open(QTSession.java:608)
from processing.video.MovieMaker.<init>(MovieMaker.java:199)
from processing.video.MovieMaker.<init>(MovieMaker.java:162)
from sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
from sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
from sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
from java.lang.reflect.Constructor.newInstance(Constructor.java:513)
from org.jruby.javasupport.JavaConstructor.newInstanceDirect(JavaConstructor.java:243)
Any idea what's wrong?
i guess you are running Mac OS
.
In this case, you have to force your JVM in 32 bits mode. 2 possibilities:
- go in
Utilities > Java Preferences
and drag the 32 bits line on top of the list. This should fix the problem. - OR grab the latest
ruby-processing (gem install ruby-processing)
, and put the following lines in the YAML configuration file$HOME/.rp5rc
java_args: -d32
this will force the JVM in 32 bits mode.
hope this help.
精彩评论