简体   繁体   English

是否可以在 fmp4 中重新排序和重组片段?

[英]Is it possible to reorder and recombine fragments in fmp4?

I have fragmented mp4 which I want to send users through HLS.我有碎片 mp4,我想通过 HLS 发送给用户。 It's ok if I just send it as is.如果我按原样发送就可以了。 But I need opportunity to reorder fragments in this video.但我需要机会重新排序此视频中的片段。

For example initial video, which looks like this: original video format例如初始视频,它看起来像这样: original video format

I want reorganize fragments and get this: expected video format我想重组片段并得到这个:预期的视频格式

I try make it locally, and it's work in VLS player (HLS).我试着在本地制作,它在 VLS 播放器 (HLS) 中工作。 For this I modified sequence number for fragments in moof (mfhd).为此,我修改了 moof (mfhd) 中片段的序列号。 But when I try play it remotely (HLS) it does not work.但是当我尝试远程播放 (HLS) 时,它不起作用。 I think, that some players (js) expect some additional information from each fragment, probably for example time offset.我认为,一些玩家 (js) 期望从每个片段中获得一些额外的信息,例如时间偏移。 But I can not find which atom (box) contain this information.但是我找不到哪个原子(盒子)包含这些信息。 I spent a lot of time searching and I'm still at the very beginning of the problem.我花了很多时间搜索,但我仍处于问题的最开始。

I tried to modify the fragment sequence number, but it doesn't work.我试图修改片段序列号,但它不起作用。

The " Track Fragment Media Decode Time Box " ( tfdt ) stores the baseMediaDecodeTime which is the accumulative decode time. Track Fragment Media Decode Time Box ”( tfdt )存储了baseMediaDecodeTime ,它是累计解码时间。

Consider the following...考虑以下...

  • baseMediaDecodeTime must increase monotonically for each chunk. baseMediaDecodeTime必须为每个块单调增加

  • This means you must update (replace) the tfdt entry of chunk with expected next tftd entry.这意味着您必须使用预期的下一个 tftd 条目更新(替换)块的tfdt条目。

  • When you naively reorder the chunks, the baseMediaDecodeTime will be invalid.当您天真地重新排序块时, baseMediaDecodeTime将无效。

The " Track Fragment Media Decode Time Box " ( tfdt ) is located inside each moof header at: Track Fragment Media Decode Time Box ”( tfdt )位于每个moof header内:

moof --> traf --> tfdt

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

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