java - No audio in MP4 file - Android -


i using mp4parsermergeaudiovideo add new audio mp4 file. library had said use .wav file, if keep .wav file in directory , give name of audiofile example.m4a, file not found exception. changed file .m4a audio file. code given below.

findviewbyid(r.id.append).setonclicklistener(new onclicklistener() {     @override     public void onclick(view v) {         string root = environment.getexternalstoragedirectory().tostring();         log.e("",""+root);         string audio = root + "/download/"+"mymovieaudio.m4a";         string video = root + "/download/"+"my_movie.mp4";         string output = root + "/download/ouput.mp4";         mux(video, audio, output);     } }); 

the mux function this

public boolean mux(string videofile, string audiofile, string outputfile) {         movie video;         try {             video = new moviecreator().build(videofile);         } catch (runtimeexception e) {             e.printstacktrace();             return false;         } catch (ioexception e) {             e.printstacktrace();             return false;         }          movie audio;         try {             audio = new moviecreator().build(audiofile);         } catch (ioexception e) {             e.printstacktrace();             return false;         } catch (nullpointerexception e) {             e.printstacktrace();             return false;         }          track audiotrack = audio.gettracks().get(0);         video.addtrack(audiotrack);          container out = new defaultmp4builder().build(video);          fileoutputstream fos;         try {             fos = new fileoutputstream(outputfile);         } catch (filenotfoundexception e) {             e.printstacktrace();             return false;         }         bufferedwritablefilebytechannel bytebufferbytechannel = new bufferedwritablefilebytechannel(fos);         try {             out.writecontainer(bytebufferbytechannel);             bytebufferbytechannel.close();             fos.close();         } catch (ioexception e) {             e.printstacktrace();             return false;         }         return true;     } 

i output.mp4 file in download directory of device. problem not have audio. please help. in advance.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -