用java制作软件的视频,用Java中的图像制作视频文件?

I make a robot that has an auto delay of 50 then do this.

for(int a=0;a<1000;a++;)

{

Rectangle screenRect= new Rectangle(300,400);

al.add(r.createScreenCapture(screenRect));

}

File outputfile = new File(output,"Test.mp4");

AWTSequenceEncoder enc =

AWTSequenceEncoder.createSequenceEncoder(outputfile,20);

for (BufferedImage bi : al)

enc.encodeImage(bi);

enc.finish();`

output is the path to my desktop. These are the errors I have gotten:

Exception in thread "main" java.lang.ExceptionInInitializerError

at org.jcodec.containers.mp4.muxer.MP4Muxer.addTrack(MP4Muxer.java:91)

at org.jcodec.containers.mp4.muxer.MP4Muxer.addTrack(MP4Muxer.java:87)

at org.jcodec.containers.mp4.muxer.MP4Muxer.addVideoTrack(MP4Muxer.java:196)

at org.jcodec.api.transcode.SinkImpl.outputVideoPacket(SinkImpl.java:69)

at org.jcodec.api.transcode.SinkImpl.outputVideoFrame(SinkImpl.java:223)

at org.jcodec.api.SequenceEncoder.encodeNativeFrame(SequenceEncoder.java:101)

at org.jcodec.api.awt.AWTSequenceEncoder.encodeImage(AWTSequenceEncoder.java:49)

at Test.main(Test.java:47)

Caused by: java.lang.RuntimeException: Uncompilable source code - cannot find symbol

symbol: class Nullable

location: package javax.annotation

at org.jcodec.common.Preconditions.(Preconditions.java:17)

... 8 more

解决方案

Uncompilable source code - cannot find symbol

symbol: class Nullable

location: package javax.annotation

The compiler can't find javax.annotation.Nullable. You are using Jcodec, which depends on the Javax.annotation API, which you don't seem to have included. You can find it here.

However, you should consider building your project with Maven, which will take care of such dependencies for you. I wouldn't be surprised if there are further dependencies hidden.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值