我很难在代码中找到错误。
我尝试了一些我在网上找到的东西,但无法让它们中的任何一个起作用。
javax.media.NoProcessorException:找不到处理器:com.ibm.media.protocol.MergingPullDataSource@14514713 这应该意味着合并来源的数据类型不能使用,但我找不到原因
我已经尝试了几种格式,也将我的音频文件转换为.mov
。
如果有人可以帮助我,我会非常感激。
public static void main(String args[]){
//Creating the files with my path
File audio = new File("C:\\ffmpeg\\bin\\light.wav");
File video = new File("C:\\ffmpeg\\bin\\output.mov");
try {
//Create the sources
DataSource audioSource = Manager.createDataSource(audio.toURI().toURL());
DataSource videoSource = Manager.createDataSource(video.toURI().toURL());
//Merge them
DataSource[] vidAud = new DataSource[2];
vidAud[0] = videoSource;
vidAud[1] = audioSource;
DataSource finalVideo = Manager.createMergingDataSource(vidAud);
//Choose the destination to put it
MediaLocator dest = new MediaLocator("file:c:\\ffmpeg\\bin\\plsWork.mov");
VideoFormat videoF = new VideoFormat(VideoFormat.INDEO50);
AudioFormat audioF = new AudioFormat(AudioFormat.GSM_MS);
Format outputFormat[] = new Format[2];
outputFormat[0] = videoF;
outputFormat[1] = audioF;
FileTypeDescriptor outputType = new FileTypeDescriptor(FileTypeDescriptor.AIFF);
ProcessorModel procModel = new ProcessorModel(finalVideo, outputFormat, outputType);
Processor proc = null;
proc = Manager.createRealizedProcessor(procModel);
DataSource source = proc.getDataOutput();
DataSink sink = Manager.createDataSink(source, dest);
sink.open();
} catch(Exception e) {
e.printStackTrace();
}
}
祝你好运