Commit 8794e1cd authored by a.sujatanagarjuna's avatar a.sujatanagarjuna

Upload python script to encode media

parent 48dbd72b
import base64
import sys
filename = sys.argv[1]
print("Encoding "+ filename)
with open(filename, "rb") as media_file:
encoded_media = base64.b64encode(
print(len(encoded_media), type(encoded_media), encoded_media[:10])
extension = filename.split(".")[-1]
html_comp = "<"+("video" if extension == "mp4" else "img")+" src='"+("data:video/mp4;" if extension == "mp4" else "data:image/jpg;")+" base64, "+encoded_media.decode("ascii")+"'>"
with open(filename+".o66.html", "w") as blockfile:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment