Android MP4Parser cannot play video -
Android MP4Parser cannot play video -
i'm attempting append simple, 3 sec outro video existing video using mp4parser, reason cannot play video after merge happens. i'm getting infamous "sorry, video cannot played" error when trying play video gallery. have similar experience doing this? i'm testing on htc 1 running 4.4 kitkat
here's method merge .mp4 clips single one, taken appendexample mp4parser itself.
private void createfinaloutputvideo() { camerahelper helper = new camerahelper(this); file outfile = helper.getoutputmediafile(camerahelper.media_type_video); seek { movie[] movies = new movie[2]; movies[0] = moviecreator.build(mvideopath); movies[1] = moviecreator.build(moutropath); log.d("shareactivity", "video 1 path " + mvideopath); log.d("shareactivity", "video 2 path " + moutropath); list<track> videotracks = new linkedlist<track>(); list<track> audiotracks = new linkedlist<track>(); (movie m : movies) { (track t : m.gettracks()) { if (t.gethandler().equals("soun")) { audiotracks.add(t); } if (t.gethandler().equals("vide")) { videotracks.add(t); } } } film 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()]))); } container out = new defaultmp4builder().build(result); filechannel fc = new randomaccessfile(string.format(outfile.getpath()), "rw").getchannel(); out.writecontainer(fc); fc.close(); toast.maketext(this, "merge successful! output path " + outfile.getabsolutepath(), toast.length_short).show(); } grab (ioexception e) { e.printstacktrace(); toast.maketext(this, "error merging videos!", toast.length_short).show(); } }
has ever had issue mp4parser? great if sebastian chime in here.
android video android-camera video-processing mp4parser
Comments
Post a Comment