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();

test-java-mp4parser.mp4using my tag-parser.java, I noticed that the file has 2 duplicatesftyptag. The specification says this tag must be one and only one. First one specifiediso6andmp41and the other one hasmp42, iso6, avc1andisomfor it's compatible brands. Usingffmpegto rearrange the tags did solve the problem:ffmpeg -i test-java-mp4parser.mp4 -acodec copy -vcodec copy output.mp4.ftypand amoovat all, but just astyp. VLC is already able to play the DASH manifest by ignoring the extra atoms, just by providing the right segment list.m4ss can be concat easily with its init file. Looking at the firsttest5-128k-163497124.m4s, it hasftyptag which it shouldn't and I dont check the other two. I'm sure they have one too. Note: someMPEG-DASHs do NOT have an init file.