Hi,
We are using Wowza for packaging mp4 files for ABR HLS delivery. The mp4 files are generated using FFmpeg+x264 and are all verified to be key frame aligned (KFA) with respect to PTS timestamps. We currently generate around 4-7 different renditions for each asset, ranging from 1080pHiP to 180pCBP.
It seems that wowza corrupts the KFA when it packages the mp4 files into MPEG-TS streams used for HLS delivery. The problem seems to arise for renditions containing B-frames (HiP/MP) for which x264 generates negative DTS on the first key frame (PTS for the first key frame in all renditions is zero).
Analyzing the resulting MPEG-TS segments after packaging with wowza, we see that all renditions using CBP are PTS aligned and all renditions using B frames (HiP/MP) are aligned, but CBP renditions are not aligned with HiP/MP renditions.
Our Wowza setup is pretty straight forward. We’re running 4.5.0 and we just add all mp4 files to the content directory, together with a SMIL file listing all renditions.
Here’s an example of what we see.
PTS/DTS values (in seconds) of first (key) frame in each mp4 rendition:
Rendition PTS DTS
1080p 0 -0.083417
720p 0 -0.083417
360p 0 0
180p 0 0
PTS/DTS values (in seconds) of first (key) frame in each MPEG-TS segment in each rendition:
Rendition PTS DTS
1080p 0.083 0
720p 0.083 0
360p 0 0
180p 0 0
It seems that wowza shifts the timestamps differently for the HiP/MP renditions (negative DTS) compared to CBP renditions.
I understand that you cannot have negative timestamps in MPEG-TS, but this is typically solved by adding an offset, e.g. 10 seconds, to all timestamps, for all renditions.
I read here [https://www.wowza.com/docs/how-to-debug-encoder-multi-bitrate-keyframe-alignment that wowza should default to align on PTS, which makes sense, but here it seems that wowza actually shifts the timestamps differently in different renditions to achieve DTS sync.
Are there any configuration options we can use to achieve PTS sync on our generated HLS streams?
Regards Stefan