> ## Documentation Index
> Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt
> Use this file to discover all available pages before exploring further.

# Trim videos in Node.js (video tutorial)

[githublink]: https://github.com/cloudinary-community/cloudinary-examples/blob/main/examples/node-transformations-effects/video-trim.js

## Overview

This video tutorial teaches you how to trim videos on the fly using the Cloudinary Node.js SDK.

## Video tutorial

  This video is brought to you by Cloudinary's video player - embed your own!Use the controls to set the playback speed, navigate to chapters of interest and select subtitles in your preferred language.

> **TIP**: :title=View the code

You can find the code from this tutorial in [GitHub][githublink].
## Tutorial contents
This tutorial presents the following topics. Click a timestamp to jump to that part of the video.### Introduction
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=0 :sec=00 :player=cld} | If you want to remove the start or end of a video, you can use Cloudinary's [video transformation capabilities](video_trimming_and_concatenating#trimming_videos) to do this on the fly.
|

### Define the length of your video
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=0 :sec=23 :player=cld} | Having [installed and configured the Cloudinary Node.js SDK](node_configuration_tutorial) 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
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=0 :sec=38 :player=cld} | 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](upload_images) 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:
|

```nodejs
const start_offset = 6.5;
const end_offset = 20;

const videoUrl = cloudinary.url('samples/elephants.mp4', {
  resource_type: 'video',
  transformation: [
    {
      start_offset, 
      end_offset,
    },
  ],
});
```

See the full code example in [GitHub](https://github.com/cloudinary-community/cloudinary-examples/blob/main/examples/node-transformations-effects/video-trim.js).

### Check the resulting URL
{table:class=tutorial-bullets}|  | 
| --- | --- |
|{videotime:id=media :min=1 :sec=27 :player=cld} | Open the resulting URL in a browser to see the trimmed elephants video.
|
## Keep learning

> **READING**:
>
> * Learn about different ways to [trim and concatenate your videos](video_trimming_and_concatenating).

> * Discover more about [transforming videos](video_manipulation_and_delivery) and select the video filter in the [Transformation URL API reference](transformation_reference) to see all video transformations. 

> * Find out more about the capabilities of the Cloudinary [Node.js SDK](node_integration).

> * Take a look at the [User-generated content guide](user_generated_content) 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](https://www.youtube.com/playlist?list=PL8dVGjLA2oMpaTbvoKCaRNBMQzBUIv7N8) on the [Cloudinary YouTube channel](https://www.youtube.com/cloudinary).

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

  
  
  
    Upload Videos in Node.js
    Upload videos to Cloudinary using the Node.js SDK 
  

  
  
  
    Video Transformations
    Build an e-commerce video showcasing products, in Node.js 
  

  
  
  
    Splice Videos in Node.js
    Splice two videos together using the Node.js SDK 
  

&nbsp;

&nbsp;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.
&nbsp;
