I want to merge a TS video list and convert it into MP4 video, I noticed that Encoder has an encode overload method that can process batch urls, I used it, but I found it works normally, but only the first TS section output file after execution, that is, it is not merged, please give me some help.
List<String> urlList = m3u8.getUrlList();
ArrayList<MultimediaObject> multis = new ArrayList<MultimediaObject>();
EncodingAttributes ea = new EncodingAttributes();
VideoAttributes va = new VideoAttributes();
AudioAttributes aa = new AudioAttributes();
va.setCodec("h264");
ea.setOutputFormat("mp4");
ea.setVideoAttributes(va);
ea.setAudioAttributes(aa);
Encoder encoder = new Encoder();
MultimediaObject multi = null;
for (int i = 0; i < urlList.size(); i++) {
multi = new MultimediaObject(new URL(urlList.get(i)));
multis.add(multi);
}
multi = null;
File targetFile = null;
String fileName = UUID.randomUUID().toString();
if (Post.isWindows()) {
targetFile = new File("D:\\back\\" + fileName + ".mp4");
}else {
targetFile = new File(File.separator + "usr" + File.separator + "local" + File.separator + "file" + File.separator + fileName + ".mp4");
}
encoder.encode(multis, targetFile, ea);
I want to merge a TS video list and convert it into MP4 video, I noticed that Encoder has an encode overload method that can process batch urls, I used it, but I found it works normally, but only the first TS section output file after execution, that is, it is not merged, please give me some help.