I'm making a project that the single objective is to transform 2 .mp4 files in a single one. For this I'm transforming the files into 2 byte[] and making it into a single one, but when I make the BufferedOutputStream
on it it only keeps the content of one file, while occupying the same space in memory as the two combine. There is the code I'm using:
public byte[] whole(){
Array<byte[]> fs = filme();
Array<Byte> bb = new Array<Byte>();
for(byte[] b : fs){
for(int i = 0; i<b.length; i++){
bb.add(b[i]);
}
}
byte[] whl = new byte[bb.size];
for(int i = 0; i<whl.length; i++){
whl[i] = bb.get(i);
}
return whl;
}
this part of the code transforms an List of byte Arrays into an single byte array. If you test and split the byte array into two files with the same length as the two initial ones, it makes the same two beginning files, exactly as they were before.
public FilmFile transform(byte[] go, String path) throws IOException{
FileOutputStream out = new FileOutputStream(path);
bos = new BufferedOutputStream(out);
bos.write(go);
FilmFile f = new FilmFile(path);
return f;
}
this code transforms the previously mentioned byte array that combined the two files into an single mp4 file, but it's instead occupying the space of the two and only displaying onde video. Some informations, to get info about the movie i'm using JCODEC and the project is in gradle. Here's the FilmFile code: https://docs.google.com/document/d/1IHdG3gDeRmKXwRT2LJbsC5zI7K5kP4kuNAwMjCh7wII/edit?usp=sharing Thanks for your help, and sorry the bad english.