2011-12-01 143 views
2

我使用xuggler API將視頻從一種格式轉碼爲另一種格式。Xuggler錯誤:無法打開

繼例如,通過

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) 

試過用不同的文件。不過,結果是相同。

回答

0

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

0

問題是您的Windows版本32或64位和xuggle版本。 如果Windows 64並使Java 64,並嘗試找到XUGGLE 64,但如果你做JAVA 32 XUGGG 32,那麼你仍然會有同樣的錯誤。
Xuggle說我不能在amd64中使用這個dll