2

我正在使用 xuggler API 将视频从一种格式转码为另一种格式。

按照示例,由

http://wiki.xuggle.com/MediaTool_Introduction & http://www.javacodegeeks.com/2011/02/xuggler-tutorial-transcoding-media.html

 public void convertVideo() {

 String sourceUrl = getResourceDirectory() + "/in/AV36_1.AVI";
 String destUrl = getResourceDirectory() + "/out/output.mp4";

 IMediaReader reader = ToolFactory.makeReader(sourceUrl);

 // add a viewer to the reader, to see progress as the media is
 // transcoded
 reader.addListener(ToolFactory.makeViewer(true));

 // create a writer which receives the decoded media from
 // reader, encodes it and writes it out to the specified file
 IMediaWriter writer = ToolFactory.makeWriter(destUrl, reader);

 // add a debug listener to the writer to see media writer events
 writer.addListener(ToolFactory.makeDebugListener());


 ////
 ////       // create the media writer
 reader.addListener(ToolFactory.makeWriter(destUrl, reader));

 // read packets from the source file, which dispatch events to the
 // writer, this will continue until 


 while (reader.readPacket() == null)
  do {} while (false);
}

提供无法打开异常:

  Exception in thread "main" java.lang.RuntimeException: could not open: D:\Malhar\project_works\VideoConvertter/resources/in/AV36_1.AVI
    at com.xuggle.mediatool.MediaReader.open(MediaReader.java:637)
    at com.xuggle.mediatool.MediaReader.readPacket(MediaReader.java:434)
    at util.VideoEncoder.convertVideo(VideoEncoder.java:38)
    at ConvertVideo.main(ConvertVideo.java:12)

尝试过使用不同的文件来..但是,结果是一样的。

4

2 回答 2

0

问题是您的 Windows 版本 32 或 64 位以及 xuggle 版本。如果 windows 64 并 make java 64 并尝试查找 xuggle 64 但如果您执行 java 32 xuggle 32 那么您仍然会遇到相同的错误。
Xuggle说我不能在amd64中使用这个dll

于 2012-09-10T13:45:44.403 回答
0

您是否注意到您在同一个 URL 中使用了 unix / 和 windows \?

于 2012-04-02T13:58:58.623 回答