Skip to content

Navigation Menu

Sign in
Sign up

Use threefive to decode SCTE35 Markers from UDP / RTP / SRT stream #91

Answered by futzu
pcb105 asked this question in Q&A
Discussion options

Hello,
I am trying to create a python program that will parse (or decode) SCTE35 messages from a TS stream that is sent over UDP / RTP or SRT. I have tested the very simple code:

import sys
import threefive

if name == "main":
if len(sys.argv) > 1:
for arg in sys.argv[1:]:
strm = threefive.Stream(arg)
SCTE35 = strm.decode()
else:
threefive.decode(sys.stdin.buffer)

and it work when I use multicast... arg = udp://239.35.0.35:1234

I can not use multicast in the final implementation, due to network rules. It would be great to use unicast (UDP or RTP) or even better srt.
I tried to set up a unicast udp stream to the following URL... udp://10.0.0.100:1234, and then setting the arg to the same and it errors out (I guess somewhere in the code it is checking for a multicast address range).

Any ideas. I thought of using ffmpeg to do the receiving but I thought I would ask first.

Thanks in Advance,

-Paul

PS Awesome library. It help me find a couple of issues already. Would love to find more once I can run on other network.

You must be logged in to vote

I haven't found a SRT lib for python3.

Here's how I did UDP

  • udptest.py
import sys
from threefive import Stream
arg = sys.argv[1]
strm = Stream(arg)
strm.decode()
  • Run udptest.py
pypy3 udptest.py udp://192.168.12.244:1234
  • Use gums to serve an mpegts file over UDP.
 cat flat.ts | gums -a 192.168.12.244:1234
  • Output.
{
 "info_section": {
 "table_id": "0xfc",
 "section_syntax_indicator": false,
 "private": false,
 "sap_type": "0x3",
 "sap_details": "No Sap Type",
 "section_length": 64,
 "protocol_version": 0,
 "encrypted_packet": false,
 "encryption_algorithm": 0,
 "pts_adjustment_ticks": 6734276504,
 "pts...

Replies: 2 comments 1 reply

Comment options

Give me a minute, I'm looking at it.

You must be logged in to vote
0 replies
Comment options

I haven't found a SRT lib for python3.

Here's how I did UDP

  • udptest.py
import sys
from threefive import Stream
arg = sys.argv[1]
strm = Stream(arg)
strm.decode()
  • Run udptest.py
pypy3 udptest.py udp://192.168.12.244:1234
  • Use gums to serve an mpegts file over UDP.
 cat flat.ts | gums -a 192.168.12.244:1234
  • Output.
{
 "info_section": {
 "table_id": "0xfc",
 "section_syntax_indicator": false,
 "private": false,
 "sap_type": "0x3",
 "sap_details": "No Sap Type",
 "section_length": 64,
 "protocol_version": 0,
 "encrypted_packet": false,
 "encryption_algorithm": 0,
 "pts_adjustment_ticks": 6734276504,
 "pts_adjustment": 74825.294489,
 "cw_index": "0x0",
 "tier": "0x0",
 "splice_command_length": 5,
 "splice_command_type": 6,
 "descriptor_loop_length": 42,
 "crc": "0xf8bf4c82"
 },
 "command": {
 "command_length": 5,
 "command_type": 6,
 "name": "Time Signal",
 "time_specified_flag": true,
 "pts_time": 34165.4408,
 "pts_time_ticks": 3074889672
 },
 "descriptors": [
 {
 "tag": 2,
 "descriptor_length": 40,
 "name": "Segmentation Descriptor",
 "identifier": "CUEI",
 "components": [],
 "segmentation_event_id": "0xffffffff",
 "segmentation_event_cancel_indicator": false,
 "program_segmentation_flag": true,
 "segmentation_duration_flag": true,
 "delivery_not_restricted_flag": true,
 "segmentation_duration": 239.933333,
 "segmentation_duration_ticks": 21594000,
 "segmentation_message": "Break Start",
 "segmentation_upid_type": 1,
 "segmentation_upid_type_name": "Deprecated",
 "segmentation_upid_length": 20,
 "segmentation_upid": "EP04898866",
 "segmentation_type_id": 34,
 "segment_num": 2,
 "segments_expected": 9
 }
 ],
 "packet_data": {
 "pid": "0x102",
 "program": 1,
 "pts_ticks": 209888620,
 "pts": 2332.095778
 }
}
...
You must be logged in to vote
1 reply
Comment options

Thanks a lot. That worked!

Answer selected by pcb105
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /