Home - Waterfall Grid T-Grid Console Builders Recent Builds Buildslaves Changesources - JSON API - About

Change #267074

Category ffmpeg
Changed by Ben Kepner <u6bkepohnoyoudont@gmail.com>
Changed at Thu 14 May 2026 01:04:46
Repository https://git.ffmpeg.org/ffmpeg.git
Project ffmpeg
Branch master
Revision a327bc056124c595cba58885501c47bbf50830d0

Comments

avformat/hlsenc: fix segment duration with mixed stream time bases
When audio and video streams have different time bases (e.g. video at
1/90000 and audio at 1/48000), vs->start_pts was stored as a raw PTS
from whichever stream's packet arrived first. The segment split
comparison then subtracted this value from the current packet's PTS
without accounting for the time base difference, producing incorrect
elapsed time calculations.

This caused segments to be split at wrong points — either too
frequently (on every keyframe) or not at all, depending on the
relative magnitudes of the time bases.

Fix by normalizing vs->start_pts to AV_TIME_BASE_Q at the point of
assignment and converting pkt->pts to the same base before comparison.
This ensures the segment split decision is always unit-consistent
regardless of which stream's packet is being evaluated.

The bug is most easily triggered by HLS muxing with video passthrough
and audio transcode, where the video retains its container time base
while the audio encoder outputs in its native time base.

Signed-off-by: Ben Kepner <u6bkep@gmail.com>

Changed files