bash - How to use unix command 'cat' in android to concatenate two video files from sd card? -


i have split video file 2 files 'part1' , 'part2' via git bash. both these files individually unreadable. need concatenate these 2 files , play video. works fine via git bash since new android, can't seem programmatically. did come across answer here said :

string[] command = {"ls","-al"}; processbuilder builder = new processbuilder(command); builder.directory(new file(/ngs/app/abc)); p = builder.start();

however, don't know how write command 'cat part1 part2 > new.mp4' using technique. great! thanks!

you have invoke shell , pass command line script parameter. example bash shell run following

bash -c 'cat part1 part2 > new.mp4' 

given template work out following

string[] command = {"bash", "-c", "cat part1 part2 > new.mp4"}; processbuilder builder = new processbuilder(command); builder.directory(new file(/ngs/app/abc)); p = builder.start(); 

of course cat concatenates byte streams, hence name. it's trivial program smething yourself. pseudocode (actually valid python)

filnew = open("new.mp4", "wb") fil1 = open("part1", "rb") fil2 = open("part1", "rb") filnew.write( fil1.read() ) filnew.write( fil2.read() ) filnew.close() fil1.close() fil2.close() 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -