2011-09-23 74 views
2

我想使用Xuggler將mxf文件轉碼爲flv類型。使用Xuggler的MXF到FLV

但我得到這個例外 -

2011-09-23 11:48:06,328 [main] WARN com.xuggle.xuggler - Got error: picture is not of the same PixelType as this Coder expected (../../../../../../../csrc/com/xuggle/xuggler/StreamCoder.cpp:1204) 

我的代碼是非常簡單,它看起來像這樣 -

public static void main(String[] args) { 

    // create a media reader 
    IMediaReader mediaReader = ToolFactory.makeReader(inputFilename); 

    // create a media writer 
    IMediaWriter mediaWriter = ToolFactory.makeWriter(outputFilename, 
      mediaReader); 

    // add a writer to the reader, to create the output file 
    mediaReader.addListener(mediaWriter); 

    // create a media viewer with stats enabled 
    // IMediaViewer mediaViewer = ToolFactory.makeViewer(true); 

    // add a viewer to the reader, to see the decoded media 
    // mediaReader.addListener(mediaViewer); 

    // read and decode packets from the source file and 
    // and dispatch decoded audio and video to the writer 
    while (mediaReader.readPacket() == null) 
     ; 

} 

它的工作原理像MP4和MOV文件類型。

任何指針請。

由於沒有人回覆,我找不到任何解決方案,我決定使用Java的命令參數。

我嘗試這樣做,我收到錯誤 -

public class FfmpegCommandTest { 

public static void main(String args[]) { 

    String commandStr[] = { "ffmpeg -f dv -i \"C:\temp\0001NY.MXF\" -ar 44100 -v codec libx264 -maxrate 2000k -bufsize 2000k -vf scale=\"iw/2:ih/2\" -strict experimental -vstats_file \"C:\nasir\progress.txt\" \"C:\temp\0001NYoutput-short1.mov\"" }; 
    // print the command to execute 
    for (String x : commandStr) { 
     System.out.print(x + " "); 
    } 

    // execute ffmpeg with the command generated by the previous segment 
    try { 
     ProcessBuilder proc = new ProcessBuilder(commandStr); 
     proc.directory(new File("C:\temp")); 
     //proc.command(commandStr); 
     proc.start(); 

    } catch (IOException ex) {   
     ex.getMessage(); 
     ex.printStackTrace(); 
    } 
} 
} 

誤差

The system cannot find the file specified 
    at java.lang.ProcessBuilder.start(Unknown Source) 
    at com.xuggle.xuggler.demos.FfmpegCommandTest.main(FfmpegCommandTest.java:21) 
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified 
    at java.lang.ProcessImpl.create(Native Method) 
    at java.lang.ProcessImpl.<init>(Unknown Source) 
    at java.lang.ProcessImpl.start(Unknown Source) 

回答

1

該命令的東西:使用\"C:\\temp\\0001NY.MXF\"代替\「C:\ TEMP \ 0001NY.MXF \ 」。

查看雙反斜槓。