Last updated: Oct-16-2024
On this page:
Overview
This video tutorial teaches you how to trim videos on the fly using the Cloudinary Node.js 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
0:00 | If you want to remove the start or end of a video, you can use Cloudinary's video transformation capabilities to do this on the fly. |
Define the length of your video
0:23 | Having installed and configured the Cloudinary Node.js SDK in your Node.js app, define the start offset and either the end offset or duration of the video that you want to deliver. Ensure you use the variable names start_offset , end_offset and duration as these are the object key names that you need in the next step, which uses object property shorthand notation. |
Create the URL to trim the video
0:38 | Use the cloudinary.url method to create the URL to deliver the trimmed video according to the set parameters. Specify the public ID of the video that you've previously uploaded to your Cloudinary product environment, the resource type and transformation parameters. For example, to trim the samples/elephants video to make it start at 6.5 seconds and end at 20 seconds: |
See the full code example in GitHub.
Check the resulting URL
1:27 | Open the resulting URL in a browser to see the trimmed elephants video. |
Keep learning
Related topics
- Learn about different ways to trim and concatenate your videos.
- Discover more about transforming videos and select the video filter in the Transformation URL API reference to see all video transformations.
- Find out more about the capabilities of the Cloudinary Node.js SDK.
- Take a look at the User-generated content guide to see all the features you can take advantage of when uploading and displaying user-generated content on your site.
- Watch more Dev Hints videos on the Cloudinary YouTube channel.
If you like this, you might also like...
Upload Videos in Node.js
Upload videos to Cloudinary using the Node.js SDKVideo Transformations
Build an e-commerce video showcasing products, in Node.jsSplice Videos in Node.js
Splice two videos together using the Node.js SDK
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.
✖️