{"library":"rtp","title":"RTP Packet Decoder/Encoder","description":"The `rtp` library is a Python library for decoding, encoding, and interacting with Real-time Transport Protocol (RTP) packets. Currently at version 0.0.4, it is under active development by BBC R&D. This library is designed to be payload-agnostic and does not provide network functionality or handle specific payload bitstreams; it is intended to be used in conjunction with other libraries for those purposes.","language":"python","status":"active","last_verified":"Tue May 12","install":{"commands":["pip install rtp"],"cli":null},"imports":["from rtp import RTP","from rtp import Extension","from rtp import PayloadType"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from rtp import RTP, Extension, PayloadType\nfrom copy import deepcopy\n\n# Placeholder functions for demonstration, as 'rtp' is payload-agnostic\ndef getExtStartBits(): return b'\\x10\\x00'\ndef getExtBody(): return b'\\x01\\x02\\x03\\x04'\ndef getCSRCList(): return [12345]\ndef getNextPayload(): return b'\\xDE\\xAD\\xBE\\xEF'\ndef transmit(rtp_packet): print(f\"Transmitting: {rtp_packet.toBytearray().hex()}\")\ndef getNextPacket(): return bytes.fromhex('80e000000000000000000000100001020304deadbeef')\ndef MyPayloadDecoder(payload_bytes): return f\"Decoded payload: {payload_bytes.hex()}\"\ndef render(decoded_data): print(f\"Rendering: {decoded_data}\")\n\n# Encoding example\nbaseRTP = RTP(\n    marker=True,\n    payloadType=PayloadType.DYNAMIC_96, # Using a common dynamic payload type for example\n    extension=Extension(\n        startBits=getExtStartBits(),\n        headerExtension=getExtBody()\n    ),\n    csrcList=getCSRCList()\n)\n\n# Initial packet\nthisRTPBitstream = baseRTP.toBytearray()\nprint(f\"Initial RTP Packet (hex): {thisRTPBitstream.hex()}\")\n\n# Example of sending subsequent packets (simplified loop)\nnextRTP = deepcopy(baseRTP)\nnextRTP.sequenceNumber += 1\nnextRTP.timestamp += 160 # Example increment for timestamp\nnextRTP.payload = getNextPayload()\ntransmit(nextRTP)\n\n# Decoding example\ndecoded_rtp_packet = RTP().fromBytearray(getNextPacket())\ndecodedPayload = MyPayloadDecoder(decoded_rtp_packet.payload)\nrender(decodedPayload)\n\nprint(f\"Decoded Sequence Number: {decoded_rtp_packet.sequenceNumber}\")\nprint(f\"Decoded Timestamp: {decoded_rtp_packet.timestamp}\")","lang":"python","description":"This quickstart demonstrates how to create and manipulate RTP packets. It includes examples for both encoding and decoding. Note that placeholder functions (e.g., `getExtStartBits`, `getNextPayload`) are used as the `rtp` library focuses solely on RTP packet structure, not on network transmission or specific payload content.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-12","installed_version":null,"pypi_latest":"0.0.4","is_stale":null,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.8,"avg_import_s":null,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"rtp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"rtp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":1.9,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"rtp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"rtp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":1.9,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"rtp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"rtp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":1.8,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"rtp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"rtp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":1.6,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"rtp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":null},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"rtp","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":null,"install_time_s":1.8,"import_time_s":null,"mem_mb":null,"disk_size":null}]}}