The present invention proposes a seek method and device for a player in an HLS format video source scenario, the method comprising: determining the correct pts of the first frame image in the nth ts segment; obtaining the pts data of the first frame image after demultiplexing in the nth ts segment; obtaining the pts data of the nth frame image after demultiplexing in the nth ts segment; determining the pts time of the nth frame image after demultiplexing in the nth ts segment, relative to the pts time of the first frame image after demultiplexing in the ts segment offset amount; determining the pts time of the nth frame image after demultiplexing in the nth ts segment; sequentially playing multiple ts segments. The present invention realizes the accurate correction of the pts time of each frame image in multiple splicing segments of HLS format video, so that the video can be played normally, can be compatible with non-standard video, avoids the encoding server to re-encode, and also provides a good seek experience.
This document is an invention patent (CN 114257864 B) held by Yifang Information Technology Co., Ltd. It discloses a seek method and apparatus for players using HLS format video sources, addressing inaccurate playback time display and playback failures when TS segments are spliced.
The method determines correct presentation timestamps (PTS) for the first frame of each TS segment, calculates offsets relative to the first packet, and sequentially plays multiple TS segments. It also handles cross-segment playback operations triggered by user touch commands. This manual is written in Chinese.
It accurately corrects the presentation timestamp (PTS) of each image frame across multiple spliced TS segments so the video can play normally.
It is the sum of the durations of the first n-1 TS segments.
It solves inaccurate playback time display and playback failures in HLS format video sources.