This use case is a service that manually encodes a series of uncompressed .wav media segments into .m4s fragments for broadcast via MPEG-DASH, using ffmpeg to compress the .wav to .aac and sannies/mp4parser to assemble the aac audio into a .m4s media fragment.
I created this public GitHub project to reproduce the issue in its entirety.
For example, here's the custom ChunkFragmentM4sBuilder.java class.
This log is from ChunkFragmentM4sBuilderTest.java which results in the concatenated test output test-java-mp4parser.mp4 appears to be ok:
However, when I play the shipped playlist and segments using VLC, I see these failures in the logs:
mp4: Fragment sequence discontinuity detected 163497124 != 0
This error happens when VLC plays the following DASH playlist:
- test5.mpd
- test5-128k-163497124.m4s
- test5-128k-163497125.m4s
- test5-128k-163497126.m4s
- test5-128k-IS.mp4
And here is the latest implementation of my custom fragment builder class and additional notes:
Files.deleteIfExists(Path.of(m4sFilePath));
AACTrackImpl aacTrack=new AACTrackImpl(new FileDataSourceImpl(aacFilePath));
Movie movie=new Movie();
movie.addTrack(aacTrack);
Container mp4file=new ChunkFragmentM4sBuilder(seqNum).build(movie);
FileChannel fc=new FileOutputStream(m4sFilePath).getChannel();
mp4file.writeContainer(fc);
fc.close();