Convert the string "H264" to an integer code:
sum([ord(c) << (i * 8) for i, c in enumerate("H264")])
Convert the integer code (0x34363248) back to a string:
''.join([chr((0x34363248 >> (i * 8)) & 0xff) for i in range(4)])
See this gist: https://gist.github.com/eliteraspberries/b017f998c97c395881f0d2f05a08ec60
Top comments (0)