Programmable Media

Upload videos in Python (video tutorial)

Last updated: Oct-30-2024

Overview

Learn how to upload videos in Python using the Cloudinary Python SDK.

Video tutorial


View the code
You can find the code from this tutorial in GitHub.

Tutorial contents

This tutorial presents the following topics. Click a timestamp to jump to that part of the video.

Introduction

Jump to this spot in the video  0:00 In this tutorial, you'll learn how to upload small and large videos to Cloudinary using the Python SDK, a crucial part of your workflow.

Upload a small video from your local file system

Jump to this spot in the video  0:13 This tutorial assumes that you've already installed, imported and configured Cloudinary. If you need help with that, see Configure the Python SDK.

To upload, make sure the cloudinary.uploader library is imported. Use the cloudinary.uploader.upload endpoint for the upload, pass the full path of the video as the first parameter and specify resource_type as video for the second. Print the secure_url from the response.

Here's an example using a file named videos/short_video.mp4.

Run the script to upload a small video

Jump to this spot in the video  1:01 Execute your script to upload the video and display the secure URL from the response. Open the newly uploaded video in a browser using that secure URL.

Upload a large video from your local file system

Jump to this spot in the video  1:15 Keep in mind that the upload method only supports files up to 100 megabytes. To upload larger videos, use the upload_large method, which has the same signature and options as upload. Pass the full path of the video as the first parameter and specify resource_type as video for the second. Break the video upload into 6 megabyte chunks.

Here's an example using a file named videos/long_video.mp4.

Run the script to upload a small video

Jump to this spot in the video  1:34 Uploading your large video might take a while depending on its size. Once the upload is done, the secure URL from the response JSON is displayed in the terminal. Open the newly uploaded video in a browser using that secure URL.

Keep learning

Related topics

If you like this, you might also like...

Configure the Python SDK
Install and configure the Cloudinary Python SDK
Upload Images in Python
Upload images to Cloudinary using the Python SDK
Manage Images in a Django App
Use Django helper methods to upload, transform, and display assets.

 

Cloudinary Academy

 

Check out the Cloudinary Academy for free self-paced Cloudinary courses on a variety of developer or DAM topics, or register for formal instructor-led courses, either virtual or on-site.

 

✔️ Feedback sent!

Rate this page: