Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
March 28, 2022 11:37 pm GMT

Encode and decode FourCC codes, in Python

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


Original Link: https://dev.to/eliteraspberries/encode-and-decode-fourcc-codes-in-python-3k6b

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To