java - mp4parser rotate and save video -
i need rotate video 90 degrees in android project. after googling stopped @ mp4parser can integrated android. video stored on device , saved there (not sure if different name, doesn't matter much). here code i'm using (made isoviewer-1.0-rc-35), can change library 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 video original rotation, no changes done it. what's wrong?
does help? don't think should use isoparser isoviewer this?
package com.googlecode.mp4parser; import com.googlecode.mp4parser.authoring.movie; import com.googlecode.mp4parser.authoring.builder.defaultmp4builder; import com.googlecode.mp4parser.authoring.container.mp4.moviecreator; import com.googlecode.mp4parser.util.matrix; import java.io.fileoutputstream; import java.io.ioexception; public class rotate { public static void main(string[] args) throws ioexception { string f1 = appendexample.class.getprotectiondomain().getcodesource().getlocation().getfile() + "/1365070268951.mp4"; movie inmovie = moviecreator.build(f1); inmovie.setmatrix(matrix.rotate_90); new defaultmp4builder().build(inmovie).writecontainer(new fileoutputstream("output.mp4").getchannel()); } }
Comments
Post a Comment