Skip to content

Instantly share code, notes, and snippets.

@Tilka
Created November 13, 2019 01:40
Show Gist options
  • Save Tilka/d479e3adbb67663e74c847fe969e4093 to your computer and use it in GitHub Desktop.
Save Tilka/d479e3adbb67663e74c847fe969e4093 to your computer and use it in GitHub Desktop.
Python script to extract all HVQM2 videos from *.z64 files
#!/usr/bin/env python3
import struct
import sys
rom = open(sys.argv[1], 'rb').read()
pos = 0
while True:
i = rom.find(b'HVQM2 1.0', pos)
if i == -1:
break
size = struct.unpack('>I', rom[i+16:i+20])[0]
video = rom[i:i+size]
name = 'video_%u.hvqm' % i
print(name)
open(name, 'wb+').write(video)
pos = i + size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment