1

I'm trying to mix a video & audio into one video file using Google M4parser, I created the necessary paths as follows :

 path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/Download";
 audioPath = path + "/" + "audio.m4a";
 videoNoSoundPath = path + "/" + "video.mp4";
 finalVideoPath = path + "/out.mp4";

To make sure all files exist, I put a log :

 Log.d("APP:", "SIZE AUDIO: " + FileUtils.getSize(videoNoSoundPath));
 Log.d("APP:", "SIZE VIDEO: " + FileUtils.getSize(audioPath));

I'm able to see the size of each file :

1601725413.214 14511-15076/maa.abc D/APP:: SIZE AUDIO: 4.101MB
1601725413.215 14511-15076/maa.abc D/APP:: SIZE VIDEO: 156.150KB

When I run the code below, it's work perfectly fine with all Android version except Android Q :

 Mp4ParserAudioMuxer mp4ParserAudioMuxer = new Mp4ParserAudioMuxer();
 boolean isOK = mp4ParserAudioMuxer.mux(videoNoSoundPath, audioPath, finalVideoPath);
 mSubscriber.notifyData(isOK);
 Log.d("APP:", isOK ? " OK " : "NOT OK");

You can find the full mux method here

Error log :

java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List com.coremedia.iso.boxes.MovieBox.getBoxes(java.lang.Class)' on a null object reference
    at com.googlecode.mp4parser.authoring.container.mp4.MovieCreator.build(MovieCreator.java:51)
    at com.googlecode.mp4parser.authoring.container.mp4.MovieCreator.build(MovieCreator.java:38)
    at maa.abc.utils.mediautils.Mp4ParserAudioMuxer.mux(Mp4ParserAudioMuxer.java:24)
    at 

maa.abc.ui.activities.EditVideo.lambda$audioVideoMigration$7$EditVideo(EditVideo.java:330)
        at maa.abc.ui.activities.-$$Lambda$EditVideo$7NICJDo6IH3OsEAcyQtNXlJY-CI.call(Unknown Source:2)
        at com.jyuesong.android.schedule.JObservable$2.run(JObservable.java:52)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)

The issue pointed here : video = new MovieCreator().build(videoFile);

  • 1
    https://stackoverflow.com/a/64119463/115145 – CommonsWare Oct 03 '20 at 11:52
  • @CommonsWare thank you for your comment, I've already added this attribute to AndroidManifest, but the issue still present – Mouaad Abdelghafour AITALI Oct 03 '20 at 11:52
  • 1
    Copy the input files into `getCacheDir()`, set the output also to be in `getCacheDir()`, and see if you have better luck. If you do, it's a permissions problem. If the problem persists, then it is something else, and perhaps Logcat can give you more clues. – CommonsWare Oct 03 '20 at 11:53
  • Unfortunately, still not working, I've even tried to create these files into `getCacheDir`instead to `Environment.getExternalStorageDirectory().getAbsolutePath() + "/Download"` – Mouaad Abdelghafour AITALI Oct 03 '20 at 12:07
  • Next, change all your `Log` calls in `mux()`. *Always* log the full exception. So, replace stuff like `Log.e("HAN_","audio IOException"+e );` with `Log.e("HAN_","audio IOException", e);`. Then, check Logcat and see what exception(s) you are getting. – CommonsWare Oct 03 '20 at 12:09

0 Answers0