I have an mp4 file that I've created. I want to make a copy of it with a different name.
Simple task. Indeed. Tried all the ways here but none of them worked well.
The simplest way is
try {
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dest);
// Transfer bytes from in to out
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.flush();
out.close();
} catch (Exception e) {
e.printStackTrace();
}
After copying, I'm trying to run the video file. The original is working as usual, but the copy is not. Copied the files to my computer and checked for difference. I saw that the bytes are different in some places.
Tried to copy to different folders, different source files, different destination files, rebooting my device, re-install my APK... Don't know what to try anymore.
What am I doing wrong here?