Clip and stitch videos in Wowza Video with the Wowza Video REST API

Wowza Video™ allows users to clip and stitch videos to efficiently create and manage video clips, as well as seamlessly stitch together multiple clips to create engaging and cohesive video content.

Clipping allows you to edit existing videos into shorter clips and save them, while stitching allows you to combine two or more videos/clips into a new video. A use case is stitching a video clip of your company logo at the beginning of a company training video to brand your training videos.

There are two types of clipping available in Wowza Video.

  • Quick mode – Creates clips along existing video segments. If you don't need precision in your clips, this is an efficient and inexpensive choice.
  • Precise mode – Creates clips where you can specify individual frames for inclusion. The resulting clip incurs additional encoding time and cost.

This article demonstrates how to create a clip using the Wowza Video REST API.

Before you start

  • API authentication methods - We use JSON web tokens for API authentication. See Authentication for more information.
  • Environment variables - We use environment variables for the API version and your JWT in the cURL API request examples in this topic to make it easier for you to copy, paste, and run commands in your Terminal or Command Prompt window. If you don't set environment variables for these values, you'll need to manually enter the correct values in the code samples throughout this tutorial. See Tools for testing the API for instructions.

Create a clip from a video

  • Before you create a clip or stitch multiple videos, gather the ids of the video(s) you need. You can fetch the video IDs by calling the GET /videos endpoint.
  • Decide if you want to use the QUICK or the PRECISE mode.
Info

If you select PRECISE mode, you will incur additional encoding time and cost.

Send a POST request to the /clipping endpoint to create a clip.

You can use the following sample request making sure to:

  • Set id to ID(s) of the video(s) you would like to clip.
  • Set start_time to the timestamp of the video at which you decide the clip should start in 24-hour format (HH:MM:SS:FF).
  • Set stop_time to the timestamp of the video at which you decide the clip should end in 24-hour format (HH:MM:SS:FF).
  • Set asset_type to the asset type of the video(s) you intend to clip.
  • Set mode to QUICK or PRECISE .
Info

In QUICK mode, clipping can only be performed on segment breakpoints, optimizing for speed. For example, for a video that has 8-second interval breakpoint, if you specify a breakpoint outside the 8-second interval, the breakpoint is defaulted to the closest 8-second breakpoint. If you set your start as 00:00:10:00 (HH:MM:SS:FF), it will set your start to 00:00:08:00 (HH:MM:SS:FF). In PRECISE mode, clipping can be performed on the frame level, ensuring higher accuracy but requiring more processing time. PRECISE mode incurs additional encoding time and cost.

  • Set any other information you'd like, such as the clip name and description .
Info

To create multiple clips and stitch the clips together, send the id, asset_type, start_time, and stop_time for each video you intend to clip as a separate list within the clips array.

Sample request
Endpoint Reference

Copy
Copied
curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${WV_JWT}" \
-d '{ 
    "clipping": { 
        "clips": [ 
            { 
                "id": "efd11b15-b20b-4bec-ac68-06a7ee31ee35",
                "start_time": "00:00:10:00",
                "stop_time": "00:00:50:00",
                "asset_type": "VOD"
            }
        ],
        "name": "CLIP TEST",
        "description": "",
        "category_id": "98fc3838-fc8b-489c-86bd-38ec286f67a6",
        "publish_date": "2024-03-22T14:53:02+0200",
        "published": true,
        "mode": "QUICK"
    }
} ' "${WV_HOST}/api/${WV_VERSION}/clipping"

Sample response

The response might look similar to the following code:

Copy
Copied
{
    "video": {
        "id": "212c0fb3-eaae-45c9-9b16-a26d82e7a962",
        "name": "CLIP TEST",
        "description": "",
        "duration_in_ms": 583040,
        "unpublish": false,
        "unpublished_at": "2024-05-15T03:27:51+0000",
        "published": true,
        "published_at": "2024-05-15T03:27:51+0000",
        "tags": [],
        "remote": false,
        "category_id": "98fc3838-fc8b-489c-86bd-38ec286f67a6",
        "no_ads": true,
        "ad_keywords": "",
        "created_at": "2024-05-15T03:27:51+0000",
        "updated_at": "2024-05-15T03:27:52+0000",
        "state": "PROCESSING",
        "encoding_progress": 100.0,
        "upload_progress": 100.0,
        "error_message": "",
        "deactivated": false,
        "images": [
            {
                "type": "image_0",
                "url": ""
            },
            {
                "type": "image_1",
                "url": ""
            },
            {
                "type": "image_2",
                "url": ""
            },
            {
                "type": "thumbnail",
                "url": ""
            },
            {
                "type": "image",
                "url": ""
            }
        ],
        "encodings": [],
        "shallow_copy": false,
        "multiple_audio_tracks": false,
        "audio_only": true,
        "version": 1
    }
}