[BUG] Incorrect seek bar behavior on PCR wraparound in MPEG-TS (.ts) files
Łoś Łosiński <[email protected]> Sat, 30 May 2026 10:31:51 +0200
| Newsgroups | gmane.comp.video.videolan.vlc.devel |
|---|---|
| Message-ID | <nxccoaixrvlngxholwho@zwdi> |
--===============8571416759485518096==
Content-Type: multipart/alternative; boundary="=-hW15IN4PM43cipJZqMrI"
--=-hW15IN4PM43cipJZqMrI
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Subject: [BUG] Incorrect seek bar behavior on PCR wraparound in MPEG-TS (.t=
s) filesHi,I'd like to report a bug in VLC's MPEG-TS demuxer related to PCR=
discontinuity handling.**Component:** Input / Demuxer / MPEG-TS**Affected =
file type:** .ts (MPEG-2 Transport Stream)**Description:**When playing an M=
PEG-TS file that contains a PCR (Program Clock Reference) discontinuity whe=
re the timestamp jumps backwards (i.e. the next PCR value is lower than the=
previous one), VLC incorrectly calculates the playback position. As a resu=
lt, the seek bar jumps to a position beyond the end of the file, and playba=
ck skips to the end.**Root cause / expected behavior:**According to the MPE=
G-TS specification, a backward PCR jump of this kind indicates a counter wr=
aparound. The correct handling is to subtract 0x25800000000 (the PCR rollov=
er value, equal to 2^33 * 300 =E2=80=94 approximately 26.5 hours in 27 MHz =
clock units) from the timestamp, so that the relative timeline remains cons=
istent. VLC does not appear to apply this correction, causing the position =
calculation to overflow.**Steps to reproduce:**1. Open an MPEG-TS file cont=
aining a PCR discontinuity where the next PCR value is smaller than the pre=
vious one.2. Observe the seek bar =E2=80=94 at the point of the discontinui=
ty it jumps to the far right (end of file).**Expected result:** VLC detects=
the backward PCR jump, applies the rollover correction (PCR_corrected =3D =
PCR_next - 0x25800000000), and continues playback normally with the seek ba=
r position intact.**Actual result:** VLC computes an out-of-range playback =
position and jumps to the end of the file.**Reference:** ISO/IEC 13818-1 (M=
PEG-2 Systems), PCR wraparound and discontinuity handling.I can provide a s=
ample .ts file demonstrating the issue if that would help:https://wetransfe=
r.com/downloads/ddb67cd86e351cbc9318e5294da62f1520260530083020/17cbafc716e5=
19d399c7ba479c4d813320260530083100/1db6b6?utm_source=3Dwt_sendgrid&utm_=
medium=3Demail&utm_campaign=3DTRN_DL_WTP_01&trk=3DTRN_DL_WTP_01Than=
ks for your work on VLC!
--=-hW15IN4PM43cipJZqMrI
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w=
3.org/TR/REC-html40/loose.dtd">
<html><body><p>Subject: [BUG] Incorrect seek bar behavior on PCR wraparound=
in MPEG-TS (.ts) files<br><br>Hi,<br><br>I'd like to report a bug in VLC's=
MPEG-TS demuxer related to PCR discontinuity handling.<br><br>**Component:=
** Input / Demuxer / MPEG-TS<br>**Affected file type:** .ts (MPEG-2 Transpo=
rt Stream)<br><br>**Description:**<br><br>When playing an MPEG-TS file that=
contains a PCR (Program Clock Reference) discontinuity where the timestamp=
jumps backwards (i.e. the next PCR value is lower than the previous one), =
VLC incorrectly calculates the playback position. As a result, the seek bar=
jumps to a position beyond the end of the file, and playback skips to the =
end.<br><br>**Root cause / expected behavior:**<br><br>According to the MPE=
G-TS specification, a backward PCR jump of this kind indicates a counter wr=
aparound. The correct handling is to subtract 0x25800000000 (the PCR rollov=
er value, equal to 2^33 * 300 =E2=80=94 approximately 26.5 hours in 27 MHz =
clock units) from the timestamp, so that the relative timeline remains cons=
istent. VLC does not appear to apply this correction, causing the position =
calculation to overflow.<br><br>**Steps to reproduce:**<br>1. Open an MPEG-=
TS file containing a PCR discontinuity where the next PCR value is smaller =
than the previous one.<br>2. Observe the seek bar =E2=80=94 at the point of=
the discontinuity it jumps to the far right (end of file).<br><br>**Expect=
ed result:** VLC detects the backward PCR jump, applies the rollover correc=
tion (PCR_corrected =3D PCR_next - 0x25800000000), and continues playback n=
ormally with the seek bar position intact.<br><br>**Actual result:** VLC co=
mputes an out-of-range playback position and jumps to the end of the file.<=
br><br>**Reference:** ISO/IEC 13818-1 (MPEG-2 Systems), PCR wraparound and =
discontinuity handling.<br><br>I can provide a sample .ts file demonstratin=
g the issue if that would help:<br><br>https://wetransfer.com/downloads/ddb=
67cd86e351cbc9318e5294da62f1520260530083020/17cbafc716e519d399c7ba479c4d813=
320260530083100/1db6b6?utm_source=3Dwt_sendgrid&utm_medium=3Demail&=
utm_campaign=3DTRN_DL_WTP_01&trk=3DTRN_DL_WTP_01<br><br>Thanks for your=
work on VLC!<style type=3D"text/css">#icselection13 {width: 100% !importan=
t; height: 100% !important; padding-top: 0px !important; overflow: visible =
!important;}</style><style type=3D"text/css">#icselection13 {width: 100% !i=
mportant; height: 100% !important; padding-top: 0px !important; overflow: v=
isible !important;}</style></p></body></html>
--=-hW15IN4PM43cipJZqMrI--
--===============8571416759485518096==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
_______________________________________________
vlc-devel mailing list
To unsubscribe or modify your subscription options:
https://mailman.videolan.org/listinfo/vlc-devel
--===============8571416759485518096==--