Ashley P.

asked • 05/05/23

Python Programming - Reading & Resizing Videos in Google Colab Using OpenCV

I used the below code to read and display a video file in Google Colab. However, I do not understand how to resize it to a specific size. Any help would be highly appreciated!



from IPython.display import HTML

from base64 import b64encode


video_path = '/Videos/dog.mp4'


mp4 = open(video_path, "rb").read()

data_url = "data:video/mp4;base64," + b64encode(mp4).decode()

HTML(f"""

<video width=400 controls><source src="{data_url}" type="video/mp4">

</video>""")


2 Answers By Expert Tutors

By:

Q K. answered • 05/05/23

Tutor
New to Wyzant

Stay Hungry! Stay Foolish!

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.