{"id":20331142,"url":"https://github.com/comcast/scte35-go","last_synced_at":"2025-08-21T15:33:22.486Z","repository":{"id":44884419,"uuid":"381146448","full_name":"Comcast/scte35-go","owner":"Comcast","description":"Golang implementation of ANSI/SCTE-35","archived":false,"fork":false,"pushed_at":"2025-08-07T06:12:43.000Z","size":7624,"stargazers_count":41,"open_issues_count":1,"forks_count":16,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-08-07T08:22:48.160Z","etag":null,"topics":["decoder","encoder","go","golang","mpeg-ts","scte-35","signaling","video"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Comcast.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-06-28T19:54:56.000Z","updated_at":"2025-08-07T06:12:46.000Z","dependencies_parsed_at":"2023-11-09T10:53:45.833Z","dependency_job_id":"c3f8d504-4afb-481c-8f50-27b0e31f361f","html_url":"https://github.com/Comcast/scte35-go","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/Comcast/scte35-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comcast%2Fscte35-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comcast%2Fscte35-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comcast%2Fscte35-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comcast%2Fscte35-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Comcast","download_url":"https://codeload.github.com/Comcast/scte35-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Comcast%2Fscte35-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271500361,"owners_count":24770375,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decoder","encoder","go","golang","mpeg-ts","scte-35","signaling","video"],"created_at":"2024-11-14T20:18:55.596Z","updated_at":"2025-08-21T15:33:22.476Z","avatar_url":"https://github.com/Comcast.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# scte35-go: ANSI/SCTE 35 Decoder/Encoder\n\n`scte35-go` is a Go library to supports creating, decorating, and analyzing\nbinary Digital Program Insertion Cueing Messages.\n\nThis library is fully compliant and compatible with all versions of the\n[ANSI/SCTE 35](https://www.scte.org/standards-development/library/standards-catalog/scte-35-2019/)\nspecification up to and including [ANSI/SCTE 35 2022b](./docs/SCTE_35_2022b.pdf).\n\nThis project uses [Semantic Versioning](https://semver.org) and is published as\na [Go Module](https://blog.golang.org/using-go-modules).\n\n[![Build Status](https://github.com/Comcast/scte35-go/actions/workflows/check.yml/badge.svg)](https://github.com/Comcast/scte35-go/actions/workflows/check.yml)\n[![PkgGoDev](https://pkg.go.dev/badge/github.com/Comcast/scte35-go)](https://pkg.go.dev/github.com/Comcast/scte35-go)\n\n## Getting Started\n\nGet the module:\n\n```shell\n$ go get github.com/Comcast/scte35-go\ngo get: added github.com/Comcast/scte35-go v1.2.1\n```\n\n## Code Examples\n\nAdditional examples can be found in [examples](./examples).\n\n#### Decode Signal\n\nBinary signals can be quickly and easily decoded from base-64 or hexadecimal\nstrings.\n\nThe results can be output as a:\n* String - emulating the table structure used in the [SCTE 35 specification](./docs/SCTE_35_2022b.pdf).\n* XML - compliant with the [SCTE 35 XML Schema](./docs/scte_35_20220816.xsd)\n* JSON - for integrating with JSON based tools such as [jq](https://stedolan.github.io/jq/)\n\n[examples/simple_decode/main.go](examples/simple_decode/main.go)\n\n```go\npackage main\n\nimport (\n\t\"encoding/json\"\n\t\"encoding/xml\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/Comcast/scte35-go/pkg/scte35\"\n)\n\nfunc main() {\n\tsis, _ := scte35.DecodeBase64(\"/DA8AAAAAAAAAP///wb+06ACpQAmAiRDVUVJAACcHX//AACky4AMEERJU0NZTVdGMDQ1MjAwMEgxAQEMm4c0\")\n\n\t// details\n\t_, _ = fmt.Fprintf(os.Stdout, \"\\nTable: \\n%s\\n\", sis.Table(\"\", \"\\t\"))\n\n\t// xml\n\tb, _ := xml.MarshalIndent(sis, \"\", \"\\t\")\n\t_, _ = fmt.Fprintf(os.Stdout, \"\\nXML: \\n%s\\n\", b)\n\n\t// json\n\tb, _ = json.MarshalIndent(sis, \"\", \"\\t\")\n\t_, _ = fmt.Fprintf(os.Stdout, \"\\nJSON: \\n%s\\n\", b)\n}\n```\n\n```shell\n$ go run examples/simple_decode/main.go\n\nTable: \nsplice_info_section() {\n\ttable_id: 0xfc\n\tsection_syntax_indicator: false\n\tprivate_indicator: false\n\tsap_type: 3 (Not Specified)\n\tsection_length: 60\n}\nprotocol_version: 0\nencryption_algorithm: 0 (No encryption)\npts_adjustment: 0\ncw_index: 0\ntier: 4095\nsplice_command_length: 5\nsplice_command_type: 0x06\ntime_signal() {\n\ttime_specified_flag: true\n\tpts_time: 3550479013\n}\ndescriptor_loop_length: 38\nsegmentation_descriptor() {\n\tsplice_descriptor_tag: 0x02\n\tdescriptor_length: 36\n\tidentifier: 0x43554549 (CUEI)\n\tsegmentation_event_id: 39965\n\tsegmentation_event_cancel_indicator: false\n\tsegmentation_event_id_compliance_indicator: false\n\tprogram_segmentation_flag: true\n\tsegmentation_duration_flag: true\n\tdelivery_not_restricted_flag: true\n\tsegmentation_duration: 10800000\n\tsegmentation_upid_length: 16\n\tsegmentation_upid[0] {\n\t\tsegmentation_upid_type: 0x0c (MPU())\n\t\tformat_identifier: DISC\n\t\tsegmentation_upid: WU1XRjA0NTIwMDBI\n\t}\n\tsegmentation_type_id: 0x31 (Provider Advertisement End)\n\tsegment_num: 1\n\tsegments_expected: 1\n}\n\n\nXML: \n\u003cSpliceInfoSection xmlns=\"http://www.scte.org/schemas/35\" sapType=\"3\" tier=\"4095\"\u003e\n\t\u003cEncryptedPacket xmlns=\"http://www.scte.org/schemas/35\" encryptionAlgorithm=\"0\" cwIndex=\"0\"\u003e\u003c/EncryptedPacket\u003e\n\t\u003cTimeSignal xmlns=\"http://www.scte.org/schemas/35\"\u003e\n\t\t\u003cSpliceTime xmlns=\"http://www.scte.org/schemas/35\" ptsTime=\"3550479013\"\u003e\u003c/SpliceTime\u003e\n\t\u003c/TimeSignal\u003e\n\t\u003cSegmentationDescriptor xmlns=\"http://www.scte.org/schemas/35\" segmentationEventId=\"39965\" segmentationDuration=\"10800000\" segmentationTypeId=\"49\" segmentNum=\"1\" segmentsExpected=\"1\"\u003e\n\t\t\u003cSegmentationUpid xmlns=\"http://www.scte.org/schemas/35\" segmentationUpidType=\"12\" segmentationUpidFormat=\"base-64\" formatIdentifier=\"1145656131\"\u003eWU1XRjA0NTIwMDBI\u003c/SegmentationUpid\u003e\n\t\u003c/SegmentationDescriptor\u003e\n\u003c/SpliceInfoSection\u003e\n\nJSON: \n{\n\t\"encryptedPacket\": {\n\t\t\"encryptionAlgorithm\": 0,\n\t\t\"cwIndex\": 0\n\t},\n\t\"sapType\": 3,\n\t\"spliceCommand\": {\n\t\t\"type\": 6,\n\t\t\"spliceTime\": {\n\t\t\t\"ptsTime\": 3550479013\n\t\t}\n\t},\n\t\"spliceDescriptors\": [\n\t\t{\n\t\t\t\"type\": 2,\n\t\t\t\"segmentationUpids\": [\n\t\t\t\t{\n\t\t\t\t\t\"segmentationUpidType\": 12,\n\t\t\t\t\t\"segmentationUpidFormat\": \"base-64\",\n\t\t\t\t\t\"formatIdentifier\": 1145656131,\n\t\t\t\t\t\"value\": \"WU1XRjA0NTIwMDBI\"\n\t\t\t\t}\n\t\t\t],\n\t\t\t\"segmentationEventId\": 39965,\n\t\t\t\"segmentationDuration\": 10800000,\n\t\t\t\"segmentationTypeId\": 49,\n\t\t\t\"segmentNum\": 1,\n\t\t\t\"segmentsExpected\": 1\n\t\t}\n\t],\n\t\"tier\": 4095\n}\n```\n\n#### Encode Signal\n\nEncoding signals is equally simple. You can start from scratch and build a\n`scte35.SpliceInfoSection` or decode an existing signal and modify it to suit\nyour needs.\n\n[examples/simple_encode/main.go](examples/simple_encode/main.go)\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/Comcast/scte35-go/pkg/scte35\"\n)\n\nfunc main() {\n\t// start with a signal\n\tsis := scte35.SpliceInfoSection{\n\t\tSpliceCommand: scte35.NewTimeSignal(0x072bd0050),\n\t\tSpliceDescriptors: []scte35.SpliceDescriptor{\n\t\t\t\u0026scte35.SegmentationDescriptor{\n\t\t\t\tDeliveryRestrictions: \u0026scte35.DeliveryRestrictions{\n\t\t\t\t\tNoRegionalBlackoutFlag: true,\n\t\t\t\t\tArchiveAllowedFlag:     true,\n\t\t\t\t\tDeviceRestrictions:     scte35.DeviceRestrictionsNone,\n\t\t\t\t},\n\t\t\t\tSegmentationEventID: uint32(0x4800008e),\n\t\t\t\tSegmentationTypeID:  scte35.SegmentationTypeProviderPOStart,\n\t\t\t\tSegmentationUPIDs: []scte35.SegmentationUPID{\n\t\t\t\t\tscte35.NewSegmentationUPID(scte35.SegmentationUPIDTypeTI, []byte(\"78511452\")),\n\t\t\t\t},\n\t\t\t\tSegmentNum: 2,\n\t\t\t},\n\t\t},\n\t\tEncryptedPacket: scte35.EncryptedPacket{\n\t\t\tEncryptionAlgorithm: scte35.EncryptionAlgorithmNone,\n\t\t\tCWIndex:             255,\n\t\t},\n\t\tTier:    4095,\n\t\tSAPType: 3,\n\t}\n\n\t// encode it\n\t_, _ = fmt.Fprintf(os.Stdout, \"Original:\\n\")\n\t_, _ = fmt.Fprintf(os.Stdout, \"base-64: %s\\n\", sis.Base64())\n\t_, _ = fmt.Fprintf(os.Stdout, \"hex    : %s\\n\", sis.Hex())\n\n\t// add a segmentation descriptor\n\tsis.SpliceDescriptors = append(\n\t\tsis.SpliceDescriptors,\n\t\t\u0026scte35.DTMFDescriptor{\n\t\t\tDTMFChars: \"ABC*\",\n\t\t},\n\t)\n\n\t// encode it again\n\t_, _ = fmt.Fprintf(os.Stdout, \"Original:\\n\")\n\t_, _ = fmt.Fprintf(os.Stdout, \"base-64: %s\\n\", sis.Base64())\n\t_, _ = fmt.Fprintf(os.Stdout, \"hex    : %s\\n\", sis.Hex())\n}\n```\n\n```shell\n$ go run examples/simple_encode/main.go\nOriginal:\nbase-64: /DAvAAAAAAAA///wBQb+cr0AUAAZAhdDVUVJSAAAjn+PCAg3ODUxMTQ1MjQCADhqB9E=\nhex    : fc302f000000000000fffff00506fe72bd005000190217435545494800008e7f8f08083738353131343532340200386a07d1\nOriginal:\nbase-64: /DA7AAAAAAAA///wBQb+cr0AUAAlAhdDVUVJSAAAjn+PCAg3ODUxMTQ1MjQCAAEKQ1VFSQCfQUJDKqtwQlQ=\nhex    : fc303b000000000000fffff00506fe72bd005000250217435545494800008e7f8f08083738353131343532340200010a43554549009f4142432aab704254\n```\n\n#### Decoding Non-Compliant Signals\n\nThe SCTE 35 decoder will always return a non-nil `SpliceInfoSection`, even when\nan error occurs. This is done to help better identify the specific cause of the\ndecoding failure.\n\n[examples/bad_signal/main.go](examples/bad_signal/main.go)\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/Comcast/scte35-go/pkg/scte35\"\n)\n\nfunc main() {\n\tsis, err := scte35.DecodeBase64(\"FkC1lwP3uTQD0VvxHwVBEH89G6B7VjzaZ9eNuyUF9q8pYAIXsRM9ZpDCczBeDbytQhXkssQstGJVGcvjZ3tiIMULiA4BpRHlzLGFa0q6aVMtzk8ZRUeLcxtKibgVOKBBnkCbOQyhSflFiDkrAAIp+Fk+VRsByTSkPN3RvyK+lWcjHElhwa9hNFcAy4dm3DdeRXnrD3I2mISNc7DkgS0ReotPyp94FV77xMHT4D7SYL48XU20UM4bgg==\")\n\tif err != nil {\n\t\t_, _ = fmt.Fprintf(os.Stdout, \"Error: %s\\n\", err)\n\t}\n\t_, _ = fmt.Fprintf(os.Stdout, \"%s\\n\", sis.Table(\"\", \"\\t\"))\n}\n```\n\nAs we can see from the output below, the signal has a corrupted `component_count`,\ncausing the decoder to return a `scte.ErrBufferOverflow`:\n\n```shell\n$ go run examples/bad_signal/main.go\nError: splice_insert: buffer overflow\nsplice_info_section() {\n\ttable_id: 0xfc\n\tsection_syntax_indicator: false\n\tprivate_indicator: false\n\tsap_type: 0 (Type 1)\n\tsection_length: 347\n}\nprotocol_version: 151\nencryption_algorithm: 1 (DES – ECB mode)\npts_adjustment: 8451077123\ncw_index: 209\ntier: 1471\nsplice_command_length: 326\nsplice_command_type: 0x05\nsplice_insert() {\n\tsplice_event_id: 1091600189\n\tsplice_event_cancel_indicator: false\n\tout_of_network_indicator: true\n\tprogram_splice_flag: false\n\tduration_flag: true\n\tsplice_immediate_flag: false\n\tcomponent_count: 123\n\tcomponent[0]\n\t\tcomponent_tag: 86\n\t\ttime_specified_flag: false\n    }\n\n    ... additional components removed\n\n        auto_return: false\n        duration: 0\n        unique_program_id: 0\n        avail_num: 0\n        avails_expected: 0\n}\ndescriptor_loop_length: 0\n```\n\n#### CRC_32 Validation\n\nThe SCTE 35 decoder performs automatic `CRC_32` validation. The returned error\ncan be explicitly ignored if desired.\n\n[examples/ignore_crc32/main.go](examples/ignore_crc32/main.go)\n\n```go\npackage main\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/Comcast/scte35-go/pkg/scte35\"\n)\n\nfunc main() {\n\tscte35.Logger.SetOutput(os.Stdout)\n\n\tsis, err := scte35.DecodeBase64(\"/DA4AAAAAAAAAP/wFAUABDEAf+//mWEhzP4Azf5gAQAAAAATAhFDVUVJAAAAAX+/AQIwNAEAAKeYO3Q=\")\n\tif errors.Is(err, scte35.ErrCRC32Invalid) {\n\t\t_, _ = fmt.Fprintf(os.Stderr, \"Warning: CRC32 check failed!\\n\")\n\t}\n\t_, _ = fmt.Fprintf(os.Stdout, \"%s\\n\", sis.Table(\"\", \"\\t\"))\n}\n```\n\n```shell\n$ go run examples/ignore_crc32/main.go\n2025/03/15 00:44:42 CRC_32 calculated (2811771763) != reported (2811771764)\nWarning: CRC32 check failed!\nsplice_info_section() {\n\ttable_id: 0xfc\n\n... more output removed ...\n```\n\n#### Logging\n\nAdditional diagnostics can be enabled by redirecting the output of\n`scte35.Logger`\n\n```go\nscte35.Logger.SetOutput(os.Stderr)\n```\n\n## Command Line Interface\n\nThis package also provides a simple command line interface that supports\nencoding and decoding signals from the command line.\n\n```shell\n$ ./scte35-go --help\nSCTE-35 CLI\n\nUsage:\n  scte35-go [command]\n\nAvailable Commands:\n  decode      Decode a splice_info_section from binary\n  encode      Encode a splice_info_section to binary\n  help        Help about any command\n\nFlags:\n  -h, --help   help for scte35-go\n```\n\n## License\n\n`scte35-go` is licensed under [Apache License 2.0](/LICENSE.md).\n\n## Code of Conduct\n\nWe take our [code of conduct](CODE_OF_CONDUCT.md) very seriously. Please abide\nby it.\n\n## Contributing\n\nPlease read our [contributing guide](CONTRIBUTING.md) for details on how to\ncontribute to our project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomcast%2Fscte35-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcomcast%2Fscte35-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcomcast%2Fscte35-go/lists"}