I need to rotate a video by 90 degrees in my Android project. After some googling I stopped at mp4parser which can be integrated with Android. The video is stored on the device and will be saved there also (not sure if with a different name, but this doesn't matter that much). Here is the code I'm using (made with isoviewer-1.0-RC-35), but I can change the library to version 2.0 if needed:
try
{
String inputVideoName = "path_to_a_video";
IsoFile out = new IsoFile(inputVideoName);
out.getMovieBox().getMovieHeaderBox().setMatrix(Matrix.ROTATE_90);
File outputVideoName = new File("path_to_a_saved_processed_video");
if (!outputVideoName.exists())
outputVideoName.createNewFile();
FileOutputStream fos = new FileOutputStream(outputVideoName);
out.writeContainer(fos.getChannel());
fos.close();
out.close();
}
catch (IOException e) {
Log.e("test", "some exception", e);
}
The code compiles, runs, saves the video but with the original rotation, so no changes done to it. What's wrong?