1

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:

Concatenated init .mp4 and fragment .m4s are 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:

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();
8
  • Feedback is appreciated if you believe this is a poor question. Commented Oct 23, 2021 at 8:07
  • After some diggings with your test-java-mp4parser.mp4 using my tag-parser.java, I noticed that the file has 2 duplicates ftyp tag. The specification says this tag must be one and only one. First one specified iso6 and mp41 and the other one has mp42, iso6, avc1 and isom for it's compatible brands. Using ffmpeg to rearrange the tags did solve the problem: ffmpeg -i test-java-mp4parser.mp4 -acodec copy -vcodec copy output.mp4. Commented Oct 23, 2021 at 12:48
  • @Darkman That's because the file is a concatenation of the segments used as a test. The problem is with the segments which should not have a ftyp and a moov at all, but just a styp. VLC is already able to play the DASH manifest by ignoring the extra atoms, just by providing the right segment list. Commented Oct 23, 2021 at 13:18
  • @aergistal That's right. If done correctly those m4ss can be concat easily with its init file. Looking at the first test5-128k-163497124.m4s, it has ftyp tag which it shouldn't and I dont check the other two. I'm sure they have one too. Note: some MPEG-DASHs do NOT have an init file. Commented Oct 23, 2021 at 13:30
  • 1
    @Darkman No you don't, they're just self-initialized segments. Commented Oct 23, 2021 at 16:05

1 Answer 1

0

The VLC message is just an info entry and not an error. It's expected since the starting sequence number corresponds to the live-edge.

You cannot playback that manifest once the live-edge went past the time of the last segment of those 3 provided. You would need to continue generating new segments corrresponding to the current time.

You can test this easily by making the manifest static, adding a segment list and modifiying the start number.


Your segments look self-initialized but are not declared as such which will lead to problems. It also wastes bandwidth as you already provide an initialization segment.

As a reminder you should have:

  • an init segment with ftyp and moov
  • a series of media segments with styp (optional), moof, mdat
Sign up to request clarification or add additional context in comments.

6 Comments

Not to brush off your point @aergistal I believe in your expertise! Just that as mentioned, I've played back both types of segments using the identical playlist file. One works with no errors in the logs, and one fails to play yet shows errors. This leads me to believe that there is some difference in the files. Does my logic make sense?
It would help to post the complete VLC debug log and version. It played on my end with the segments you provided renamed to the current time, despite repeating moov atoms and inconsistent base decode times etc
Finally my third draft constructed this viable .m4s fragment
@CharneyKaye One more thing you can fix is the tfdt base media decode time which is set to 0 for your segments instead of the sum of all previous samples since the first segment (number 0).
@CharneyKaye Once done make it available on a test server and test it using the DASH-IF reference player.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.