Skip to content

Instantly share code, notes, and snippets.

@pandamoon21
Created April 2, 2022 04:52
Show Gist options
  • Save pandamoon21/dc975100979739eb640f2744cf4cf811 to your computer and use it in GitHub Desktop.
Save pandamoon21/dc975100979739eb640f2744cf4cf811 to your computer and use it in GitHub Desktop.
import base64
import uuid
from pymp4.parser import Box
def get_moov_pssh(fd):
while True:
x = Box.parse_stream(fd)
if x.type == b'moov':
for y in x.children:
if y.type == b'pssh' and y.system_ID == uuid.UUID('edef8ba9-79d6-4ace-a3c8-27dcd51d21ed'):
return base64.b64encode(y.init_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment