biim icon indicating copy to clipboard operation
biim copied to clipboard

In Formula normalizing PCR: pcr = (pcr - ts.HZ + ts.PCR_CYCLE) % ts.PCR_CYCLE.

Open TKNgu opened this issue 1 year ago • 1 comments

In Formula normalizing PCR: pcr = (pcr - ts.HZ + ts.PCR_CYCLE) % ts.PCR_CYCLE

Why need minus for ts.HZ ? And why input function def pcr is DTS ?

Sorrry for my English.

` def pcr(self, pcr: int):

pcr = (pcr - ts.HZ + ts.PCR_CYCLE) % ts.PCR_CYCLE

diff = ((pcr - self.latest_pcr_value + ts.PCR_CYCLE) % ts.PCR_CYCLE) if self.latest_pcr_value is not None else 0

self.latest_pcr_monotonic_timestamp_90khz += diff

if self.latest_pcr_datetime is None: self.latest_pcr_datetime = datetime.now(timezone.utc) - timedelta(seconds=(1))

self.latest_pcr_datetime += timedelta(seconds=(diff / ts.HZ))

self.latest_pcr_value = pcr

`

TKNgu avatar Mar 01 '25 04:03 TKNgu

@TKNgu

Why need minus for ts.HZ

Specific Muxer insert pcr greater than dts or pts, so minus 1sec to avoid that matter. 1 minute or 1 hour also ok.

input function def pcr is DTS

DTS is monotonic, there's no more reason than that. PTS is also ok for cut by IDR segement.

monyone avatar Mar 01 '25 22:03 monyone