gpt4 book ai didi

java - 为什么我的 Xuggle 视频转换器无法工作

转载 作者:行者123 更新时间:2023-12-01 14:33:28 26 4
gpt4 key购买 nike

我有这段代码:

import com.xuggle.mediatool.IMediaWriter;
import com.xuggle.mediatool.ToolFactory;
import com.xuggle.xuggler.ICodec;

public class ImageToVideo implements Runnable {

private static Dimension dimension;
private final IMediaWriter writer;
long startTime;
LoadFrame loadframe;

public ImageToVideo(int framespersecond, LoadFrame loadframe) {
this.loadframe = loadframe;
writer = ToolFactory.makeWriter(Project.getInstance().getFileURLStr() + Project.getInstance().getProjectName() + ".mp4");
dimension = Toolkit.getDefaultToolkit().getScreenSize();
writer.addVideoStream(0, 0, ICodec.ID.CODEC_ID_MPEG4, dimension.width / 2, dimension.height / 2);
startTime = System.nanoTime();
}

@Override
public void run() {
Project project = Project.getInstance();
for (int index = 0; index <= project.getTimeLineImageCount(); index++) {
loadframe.updateProgress(index/project.getTimeLineImageCount());
ImageIcon imgtoencode = (ImageIcon)project.getNextTimeLineImage();
BufferedImage imgtoencodebuf = (BufferedImage)imgtoencode.getImage();
writer.encodeVideo(0, imgtoencodebuf, System.nanoTime() - startTime, TimeUnit.NANOSECONDS);
}
project.setWalkIndexes();
writer.close();
}

}

应该将图像列表转换为视频。但是当我尝试运行它时,我收到此错误:

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at com.xuggle.ferry.JNIMemoryManager.<init>(JNIMemoryManager.java:861)
at com.xuggle.ferry.JNIMemoryManager.<clinit>(JNIMemoryManager.java:860)
at com.xuggle.mediatool.MediaWriter.<clinit>(MediaWriter.java:119)
at com.xuggle.mediatool.ToolFactory.makeWriter(ToolFactory.java:149)
at Operations.ImageToVideo.<init>(ImageToVideo.java:31)
at GUI.MainScreen.actionPerformed(MainScreen.java:501)

等等。我从互联网上的示例中获取了代码:http://examples.javacodegeeks.com/desktop-java/xuggler/create-video-from-image-frames-with-xuggler/

我对 Xuggle 真的很陌生,我希望有人能帮助我。谢谢

最佳答案

您缺少 sl4j没有它,Xuggle 将无法工作

从这里下载库--> http://www.slf4j.org/download.html并将 jar 添加到您的项目库(类路径)

关于java - 为什么我的 Xuggle 视频转换器无法工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16687668/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com