Crop Videos Online – API Tutorial

Crop Video Files

Converting video files is one thing you can do with the powerful and RESTful API of Online-Convert.com – but there is more!

Easy video editing is something the API is capable of as well. In a past article, we have already shown how to change video and audio codecs using the API, but that’s not all. The feature or editing tool we want to introduce today is how to crop videos, not with regard to runtime, but the actual screen or image dimension of the video.

 

Before we start, check out how to use our API with Postman, which is a free tool to create and send API calls. Once you got this down, let’s go to the cropping!

 

How To Crop Videos

Cropping your video requires a few additions to the options part of your POST request to our API. Thee options are rather self-explanatory, making it easy to add and apply changes. Take a look at the following:

"options": {
        "crop_top": 10,
        "crop_bottom": 50,
        "crop_left": 150,
        "crop_right": 200
      }

As you can see, the options are named after what we want to do to our video screen, namely crop, and the edge or direction where you want to crop. Thus, crop_top will crop the noted value from the top of the video, crop_bottom from the bottom, and so on. The value given for the single crop options is given in pixels.

 

Of course, you can choose to crop only from one or two sides. For example, in order to cut off black bars from the top and bottom of the video, you only have to use the respective crop options. The other ones, crop-left, and crop_right, can be left out in the command:

"options": {
        "crop_top": 300,
        "crop_bottom": 3000
      }

 

As a whole, this would result in a POST command, including the input format as well as the format you want to convert to, that looks like this:

{
    "input": [{
      "type": "remote",
      "source": "https://cdn.online-convert.com/example-file/video/mp4/example_small.mp4"
    }],
    "conversion": [{
      "category": "video",
      "target": "mp4",
      "options": {
        "crop_top": 50,
        "crop_bottom": 50,
        "crop_left": 200,
        "crop_right": 200
      }
    }]
}

Want to get in touch with us? Hit us up on our social media channels!