rotation - how to merge the mp4 videos using mp4parser which are taken from both front and back camera alternatively -
i developing app merge n number of videos using mp4parser.the videos merged taken in both front camera , camera. if merge these videos single , merging videos fine, alternative videos taken via front camera merged inverted. can do. please 1 me.
this code merge videos:
try { string f1,f2,f3; f1 = environment.getexternalstoragedirectory() + "/dcim/testvideo1.mp4";// video took via camera f2 = environment.getexternalstoragedirectory() + "/dcim/testvideo2.mp4";// video took via front camera f3 = environment.getexternalstoragedirectory() + "/dcim/testvideo3.mp4";// video took via front camera movie[] inmovies = new movie[] { moviecreator.build(f1), moviecreator.build(f2), moviecreator.build(f3) }; list<track> videotracks = new linkedlist<track>(); list<track> audiotracks = new linkedlist<track>(); (movie m : inmovies) { (track t : m.gettracks()) { if (t.gethandler().equals("soun")) { audiotracks.add(t); } if (t.gethandler().equals("vide")) { videotracks.add(t); } } } movie result = new movie(); if (audiotracks.size() > 0) { result.addtrack(new appendtrack(audiotracks .toarray(new track[audiotracks.size()]))); } if (videotracks.size() > 0) { result.addtrack(new appendtrack(videotracks .toarray(new track[videotracks.size()]))); } basiccontainer out = (basiccontainer) new defaultmp4builder().build(result); writablebytechannel fc = new randomaccessfile( string.format(environment.getexternalstoragedirectory()+ "/dcim/combinedvideo.mp4"), "rw").getchannel(); out.writecontainer(fc); fc.close(); } catch (exception e) { log.d("rvg", "exeption" + e); toast.maketext(getapplicationcontext(), "" + e, toast.length_long) .show(); }
Comments
Post a Comment