Print

Print


On Mar 13, 2013, at 10:22 PM, Jose V. Trigueros wrote:

> I have noticed that in mason.sim.util.media.MovieEncoder.java:302-303:
> 
>         // i think my hacking begins here (dan)
>         // get formats with current framerate, which should not matter
>         Format format = (Format)(ImageToBuffer.createBuffer(i,frameRate).getFormat());
>         source = new MovieEncoderDataSource(format, frameRate);
> 
> The format that is passed by the constructor is not being used here, thus causing errors when not passing the same format as the one that is automatically selected here. So, in contrary to the comment, I do believe that the format given here does matter. I have attached a patch with the proposed change.

Actually the format is used later -- in the encoding line:
	tcs[0].setFormat(encodeFormat); 

The format being passed into the MovieEncoderDataSource has to define the frame rate and the dimensions, and the encodeFormat doesn't have that.

Your proposed patch produces the following errors on my machine.

java.lang.ClassCastException: [I cannot be cast to [B
	at com.sun.media.multiplexer.video.QuicktimeMux.doProcess(QuicktimeMux.java:296)
	at com.sun.media.multiplexer.BasicMux.process(BasicMux.java:274)
	at com.sun.media.BasicMuxModule.connectorPushed(BasicMuxModule.java:406)
	at com.sun.media.BasicOutputConnector.writeReport(BasicOutputConnector.java:120)
	at com.sun.media.SourceThread.process(BasicSourceModule.java:729)
	at com.sun.media.util.LoopThread.run(LoopThread.java:135)
Exception in thread "Loop thread: com.sun.media.parser.RawPullBufferParser$FrameTrack@45cd1cea" java.lang.NullPointerException
	at com.sun.media.multiplexer.video.QuicktimeMux.writeVideoSampleDescription(QuicktimeMux.java:936)
	at com.sun.media.multiplexer.video.QuicktimeMux.writeSTSD(QuicktimeMux.java:925)
	at com.sun.media.multiplexer.video.QuicktimeMux.writeSTBL(QuicktimeMux.java:905)
	at com.sun.media.multiplexer.video.QuicktimeMux.writeMINF(QuicktimeMux.java:806)
	at com.sun.media.multiplexer.video.QuicktimeMux.writeMDIA(QuicktimeMux.java:727)
	at com.sun.media.multiplexer.video.QuicktimeMux.writeTRAK(QuicktimeMux.java:644)
	at com.sun.media.multiplexer.video.QuicktimeMux.writeMOOV(QuicktimeMux.java:582)
	at com.sun.media.multiplexer.video.QuicktimeMux.writeFooter(QuicktimeMux.java:519)
	at com.sun.media.multiplexer.BasicMux.close(BasicMux.java:142)
	at com.sun.media.BasicMuxModule.doClose(BasicMuxModule.java:172)
	at com.sun.media.PlaybackEngine.doClose(PlaybackEngine.java:872)
	at com.sun.media.BasicController.close(BasicController.java:261)
	at com.sun.media.PlaybackEngine.internalErrorOccurred(PlaybackEngine.java:1348)
	at com.sun.media.BasicMuxModule.connectorPushed(BasicMuxModule.java:411)
	at com.sun.media.BasicOutputConnector.writeReport(BasicOutputConnector.java:120)
	at com.sun.media.SourceThread.process(BasicSourceModule.java:729)
	at com.sun.media.util.LoopThread.run(LoopThread.java:135)