Compare commits
2 Commits
7c068d252a
...
6e83acac88
Author | SHA1 | Date |
---|---|---|
TPD94 | 6e83acac88 | |
TPD94 | 6ba6765d32 |
|
@ -51,4 +51,8 @@ Example:
|
||||||
|
|
||||||
In this case we got the PSSH value of `AAAAV3Bzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAADcIARIQFi99MmzyT229Exm8Vyu8FRoLYnV5ZHJta2V5b3MiEBYvfTJs8k9tvRMZvFcrvBUqAkhE`
|
In this case we got the PSSH value of `AAAAV3Bzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAADcIARIQFi99MmzyT229Exm8Vyu8FRoLYnV5ZHJta2V5b3MiEBYvfTJs8k9tvRMZvFcrvBUqAkhE`
|
||||||
|
|
||||||
Congrats, you have the PSSH!
|
Congrats, you have the PSSH!
|
||||||
|
|
||||||
|
4) Using init files
|
||||||
|
|
||||||
|
You can use [this tool](https://cdm-project.com/CDM-Tools/Obtaining-PSSH/src/branch/main/get_pssh_from_init.py "this tool") to obtain the PSSH from an init file
|
|
@ -0,0 +1,29 @@
|
||||||
|
import base64
|
||||||
|
|
||||||
|
import requests
|
||||||
|
import xmltodict
|
||||||
|
|
||||||
|
|
||||||
|
def read_pssh_from_bytes(bytes: bytes):
|
||||||
|
pssh_offset = bytes.rfind(b"pssh")
|
||||||
|
_start = pssh_offset - 4
|
||||||
|
_end = pssh_offset - 4 + bytes[pssh_offset - 1]
|
||||||
|
pssh = bytes[_start:_end]
|
||||||
|
return pssh
|
||||||
|
|
||||||
|
|
||||||
|
url = input("Enter Init segment url: ")
|
||||||
|
headers = {
|
||||||
|
# "Range": "bytes=0-962",
|
||||||
|
}
|
||||||
|
print("Downloading...")
|
||||||
|
|
||||||
|
res = requests.get(url, headers=headers)
|
||||||
|
if not res.ok:
|
||||||
|
print(f"Could not download init segment: {res.text}")
|
||||||
|
|
||||||
|
pssh = read_pssh_from_bytes(res.content)
|
||||||
|
if pssh is not None:
|
||||||
|
print(f"PSSH: {base64.b64encode(pssh).decode('utf8')}")
|
||||||
|
else:
|
||||||
|
print("Failed to extract PSSH!")
|
Loading…
Reference in New Issue