【问题标题】:How do I convert SCTE35 cue marker from JSON to binary?如何将 SCTE35 提示标记从 JSON 转换为二进制?
【发布时间】:2021-07-27 14:31:41
【问题描述】:

我正在研究 MPEG DASH,并且有类似这样的 SCTE35 二进制提示事件。

<Event id="6" presentationTime="50726727">
    <scte35:signal>
        <scte35:binary>/DBhAAAAAAAA///wBQb+qM1E7QBLAhdDVUVJSAAArX+fCAgAAAAALLLXnTUCAAIXQ1VFSUgAACZ/nwgIAAAAACyy150RAAACF0NVRUlIAAAnf58ICAAAAAAsstezEAAAihiGnw==</scte35:binary>
    </scte35:signal>
</Event>

如果使用https://openidconnectweb.azurewebsites.net/Cue?cue=/DBhAAAAAAAA///wBQb+qM1E7QBLAhdDVUVJSAAArX+fCAgAAAAALLLXnTUCAAIXQ1VFSUgAACZ/nwgIAAAAACyy150RAAACF0NVRUlIAAAnf58ICAAAAAAsstezEAAAihiGnw== 解码,它会返回一个 SpliceInfoSection JSON 对象。我希望能够对 JSON 进行更改并将其转换回二进制格式以进行测试。

任何帮助将不胜感激。

【问题讨论】:

    标签: json binary mpeg-dash scte-35


    【解决方案1】:

    三五是最简单的方法。

    a@fumatica:~/threefive$ pypy3
    Python 3.7.10 (7.3.5+dfsg-2, Jun 03 2021, 20:39:46)
    [PyPy 7.3.5 with GCC 10.2.1 20210110] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>>> import threefive
    >>>> Base64 = "/DAvAAAAAAAA///wFAVIAACPf+/+c2nALv4AUsz1AAAAAAAKAAhDVUVJAAABNWLbowo="
    >>>> cue = threefive.Cue(Base64)
    >>>> cue.decode()
    True
    >>>> cue.command
    {'calculated_length': 20, 'command_type': 5, 'name': 'Splice Insert', 
    'time_specified_flag': True, 'pts_time': 21514.559089, 'break_auto_return':True, 
    'break_duration': 60.293567, 'splice_event_id': 1207959695, 'splice_event_cancel_indicator': False, 'out_of_network_indicator': True, 
    'program_splice_flag': True, 'duration_flag': True, 'splice_immediate_flag': False, 'component_count': None, 'components': None, 'unique_program_id': 0, 
    'avail_num': 0, 'avail_expected': 0}
    
    
    # Access vars with dot notation
    
    >>>> cue.command.break_duration= 90.0
    
    # re-encode
    
    >>>> cue.encode()
    '/DAvAAAAAAAA///wFAVIAACPf+/+c2nALv4Ae5igAAAAAAAKAAhDVUVJAAABNVB2fJs='
    >>>> 
    >>>> cue.show()
    {
        "info_section": {
            "table_id": "0xfc",
            "section_syntax_indicator": false,
            "private": false,
            "sap_type": "0x3",
            "sap_details": "No Sap Type",
            "section_length": 47,
            "protocol_version": 0,
            "encrypted_packet": false,
            "encryption_algorithm": 0,
            "pts_adjustment": 0.0,
            "cw_index": "0xff",
            "tier": "0xfff",
            "splice_command_length": 20,
            "splice_command_type": 5,
            "descriptor_loop_length": 10,
            "crc": "0x62dba30a"
        },
        "command": {
            "calculated_length": 20,
            "command_type": 5,
            "name": "Splice Insert",
            "time_specified_flag": true,
            "pts_time": 21514.559089,
            "break_auto_return": true,
            "break_duration": 90.0,
            "splice_event_id": 1207959695,
            "splice_event_cancel_indicator": false,
            "out_of_network_indicator": true,
            "program_splice_flag": true,
            "duration_flag": true,
            "splice_immediate_flag": false,
            "unique_program_id": 0,
            "avail_num": 0,
            "avail_expected": 0
        },
        "descriptors": [
            {
                "tag": 0,
                "descriptor_length": 8,
                "name": "Avail Descriptor",
                "identifier": "CUEI",
                "provider_avail_id": 309
            }
        ]
    }
    

    https://github.com/futzu/scte35-threefive/blob/master/Encoding.md

    【讨论】:

      猜你喜欢
      • 2011-09-04
      • 1970-01-01
      • 1970-01-01
      • 2011-02-17
      • 1970-01-01
      • 1970-01-01
      • 2011-09-15
      相关资源
      最近更新 更多