Comcast / gots

MPEG Transport Stream handling in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Account for PTS adjustment in SCTE35 Event Streams

guygrigsby opened this issue · comments

In the CLI we do not account for the pts_adjust field when dumping SCTE35 info. I don't know if this is greater than just the CLI, but we need to figure out the extent of the issue and fix it.

It's accounted for in the actual code:

gots/scte35/scte35.go

Lines 85 to 103 in ad6cb5d

ptsAdjustment := uint40(buf.Next(5)) & 0x01ffffffff
// skip cw_index, tier and spliceCommandLength
// since it can be 0xfff(unknown) so it's pretty much useless
buf.Next(4)
s.commandType = SpliceCommandType(readByte())
switch s.commandType {
case TimeSignal, SpliceInsert:
var cmd SpliceCommand
if s.commandType == TimeSignal {
cmd, err = parseTimeSignal(buf)
} else {
cmd, err = parseSpliceInsert(buf)
}
if err != nil {
return err
}
// add the pts adjustment to get the real value
s.pts = cmd.PTS().Add(ptsAdjustment)
s.hasPTS = cmd.HasPTS()

If the CLI is using this directly and it's not computing the correct PTS values we have even more to be concerned about

That's even stranger. Got these results on a pass over with the cli. Putting them here so I don't forget.

➜  Brooklyn99_223_HD_C3_AUTH_movie_scenario1_IP_720p24_TS cli -f Brooklyn99_223_HD_C3_AUTH_movie_LVLH01.ts -scte35
Pat
	PMT PIDs map[1:480]
	Number of Programs 1
Program #1 PMT
	PIDs [481 494 500]
	Elementary Streams
		Pid 481 : StreamType 27
			SCTE Adaptation (151)
			AVC Video (40)
			EBP (233)
			Maximum Bit-Rate (877)
		Pid 494 : StreamType 15
			SCTE Adaptation (151)
			ISO 639 Language (code=eng, audioType=0)
			EBP (233)
			Maximum Bit-Rate (260)
		Pid 500 : StreamType 134
SCTE35 Message on PID 500
	Command Type TimeSignal
	PTS 0
	---> OUT Segmentation Descriptor
		Event ID 1
		Type SegDescProviderPOStart
	<--- IN Segmentation Descriptor
		Event ID 1
		Type SegDescProviderPOEnd

The Time Signal above is at PTS 0. I do not think that is correct. Coral VOD packager puts it at 185760.

@guygrigsby do you have a SCTE-35 signal that shows this?

I have an asset. I'll send it to you. Can't post it here because copyright.