有没有办法使用javacv open library合并两个以上的视频?
我尝试过以下代码,但一次只允许两个视频
void merge() {
FrameGrabber grabber1 = new FFmpegFrameGrabber(ffmpeg_link
+ "1.mp4");
grabber1.start();
FrameGrabber grabber2 = new FFmpegFrameGrabber(ffmpeg_link
+ "2.mp4");
grabber2.start();
FrameRecorder recorder2 = new FFmpegFrameRecorder("/mnt/sdcard/"
+ "output.mp4", grabber1.getImageWidth(),
grabber1.getImageHeight(), grabber1.getAudioChannels());
recorder2.setFrameRate(grabber1.getFrameRate());
recorder2.setSampleFormat(grabber1.getSampleFormat());
recorder2.setSampleRate(grabber1.getSampleRate());
recorder2.start();
Frame frame;
int j = 0;
while ((frame = grabber1.grabFrame()) != null) {
j++;
recorder2.record(frame);
}
while ((frame = grabber2.grabFrame()) != null) {
recorder2.record(frame);
}
recorder2.stop();
grabber2.stop();
grabber1.stop();
}
由于