简体   繁体   English

Java mp4parser 片段序列不连续

[英]Java mp4parser fragment sequence discontinuity

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.此用例是一项服务,它手动将一系列未压缩的 .wav 媒体片段编码为 .m4s 片段以通过 MPEG-DASH 进行广播,使用 ffmpeg 将 .wav 压缩为 .aac 并使用 sannies/mp4parser 将 aac 音频组合成 .m4s 片段。 m4s 媒体片段。

I created this public GitHub project to reproduce the issue in its entirety.我创建了这个公共 GitHub 项目来完整重现这个问题。

For example, here's the custom ChunkFragmentM4sBuilder.java class.例如,这里是自定义ChunkFragmentM4sBuilder.java类。


This log is from ChunkFragmentM4sBuilderTest.java which results in the concatenated test output test-java-mp4parser.mp4 appears to be ok:日志来自ChunkFragmentM4sBuilderTest.java导致连接的测试输出test-java-mp4parser.mp4似乎没问题:

连接 init .mp4 和 fragment .m4s 没问题

However, when I play the shipped playlist and segments using VLC, I see these failures in the logs:但是,当我使用 VLC 播放附带的播放列表和片段时,我在日志中看到这些失败:

mp4: Fragment sequence discontinuity detected 163497124 != 0

This error happens when VLC plays the following DASH playlist:当 VLC 播放以下 DASH 播放列表时会发生此错误:

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

The VLC message is just an info entry and not an error. VLC 消息只是一个信息条目,而不是错误。 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.一旦实时边缘超过所提供的 3 个片段的最后一个片段的时间,您就无法播放该清单。 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带有ftypmoov的 init 段
  • a series of media segments with styp (optional), moof , mdat一系列带有styp (可选)、 moofmdat的媒体片段

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM