我在android中使用javacv成功地从图像序列中获取了视频。现在我遇到的问题是如何将音频合并到新创建的视频中。在android或javacv集成中是否可能?
Here is my code,
String path ="/mnt/sdcard/Video_images";
File folder = new File(path);
File[] listOfFiles = folder.listFiles();
if(listOfFiles.length>0)
{
iplimage = new opencv_core.IplImage[listOfFiles.length];
for (int j = 0; j < listOfFiles.length; j++) {
String files="";
if (listOfFiles[j].isFile())
{
files = listOfFiles[j].getName();
System.out.println(" j " +j + listOfFiles[j]);
}
String[] tokens = files.split("\\.(?=[^\\.]+$)");
String name=tokens[0];
Toast.makeText(getBaseContext(), "size"+listOfFiles.length, Toast.LENGTH_SHORT).show();
iplimage[j]=cvLoadImage("/mnt/sdcard/Video_images/"+name+".jpg");
}
}
//
FFmpegFrameRecorder recorder = new
FFmpegFrameRecorder("/mnt/sdcard/Video_images
/output"+System.currentTimeMillis()+".mp4",200,150);
try {
recorder.setVideoCodec(a); //CODEC_ID_MPEG4 //CODEC_ID_MPEG1VIDEO
recorder.setFrameRate(24);
recorder.setPixelFormat(PIX_FMT_YUV420P); //PIX_FMT_YUV420P
recorder.start();
for (int i=0;i<iplimage.length;i++)
{
recorder.record(iplimage[i]);
}
recorder.stop();
}
catch (Exception e){
e.printStackTrace();
}
在这段代码中,如何合并我的音频文件?