简体   繁体   English

带有B帧的mp4文件需要CTTS框吗?

[英]is CTTS box neccessary for mp4 files with B frames?

I'm trying to play an mp4 file which does not contain ctts box which contains the presentation time offset from the decoding time. 我正在尝试播放不包含ctts框的mp4文件,该ctts框包含演示时间与解码时间的偏移量。 I know that we use ctts offsets to decide the presentation order in case of b frames. 我知道在b帧的情况下,我们使用ctts偏移量来确定显示顺序。 In the mp4 ISO document, it is mentioned that ctts is not mandatory and it is only required when the decoding and presentation time are different. 在mp4 ISO文件中,提到ctts不是强制性的,仅在解码和显示时间不同时才需要ctts。 My mp4 file conatains b frames and ctts information is neccessary for me. 我的mp4文件包含b帧和ctts信息对我来说是必需的。

my question is given that the mp4 file does not contain ctts information, is there a way to decide the presentation order? 我的问题是,mp4文件不包含ctts信息,有没有办法确定显示顺序? like manually create the ctts offset from GOP size and key frame interval. 像手动从GOP大小和关键帧间隔创建ctts偏移量。

是的,ctts框是100%必需的。

CTTS is only required if your frames were reorder. 仅当重新订购相框时才需要CTTS。 In most cases frames are reordered but not always. 在大多数情况下,帧会重新排序,但并非总是如此。 So first check if your frames are stored reordered. 因此,首先检查您的相框是否已重新排序存储。 There is no general solution to recreate the presentation time. 没有通用的解决方案来重新创建演示时间。 But most AVC stream follow the same GOP reordering pattern. 但是大多数AVC流遵循相同的GOP重新排序模式。 So on disk you see 所以在磁盘上,您会看到

I P1 B1 B2 P2 B3 which normally presents as
I B1 B2 P1 B3

So you can calculate your presentation time like this: 因此,您可以像这样计算演示时间:

     I  P1  B1  B2  P2  B3
DTS: 1  2   3   4   5   6
PTS: 1  4   2   3   7   5

The presentation time for each P frame is N + [number of trailing consecutive B-Frames] + 1. This probably works for most AVC streams but it is not guaranteed to work for all. 每个P帧的显示时间为N + [尾随连续B帧数] +1。这可能适用于大多数AVC流,但不能保证对所有AVC流都有效。

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

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