The Video Stitcher API allows you to manipulate video content to dynamically insert ads prior to delivery to client devices. Using the Video Stitcher API, you can monetize your video-on-demand (VOD) and livestream videos by inserting ads as described by metadata stored on ad servers.
The Video Stitcher API relies on the following resources:
The following image shows the four entities involved in video stitching. Each solid arrow denotes an explicit request from one entity to another. The lighter-colored, dotted-line arrows denote possible requests from one entity to another.
|
Content Provider
|
|
|
Video Stitcher API
|
|
|
Ad Provider
|
|
|
Viewer
|
This section describes the features that make up the Video Stitcher API and the primary purpose of each feature.
The Video Stitcher API supports the following formats:
For HLS, ads are stitched after the closest segment to the time offset as specified by the VMAP or SmartXML metadata.
For DASH, ads are stitched after the closest period to the time offset as specified by the VMAP or SmartXML data.
The Video Stitcher API complies with ad servers that support the following formats:
VMAP and SmartXML provide a complete ad playlist, including time offsets, to insert into a VOD asset. If you provide a VAST-only ad tag, the Video Stitcher API treats the ad pod (a sequenced group of ads) as pre-roll, and inserts them before the start of the VOD asset.
To support a variety of video players, the Video Stitcher API can trigger ad tracking events on the server-side on behalf of the client. Server-side ad tracking can help you to avoid loss of revenue due to client-side ad blocking.
The Video Stitcher API supports retrieving raw videos distributed through Media CDN and the ability to tokenize the segment URLs.
Ad videos provided from ad servers using adaptive bitrate (ABR) streaming might not always be encoded correctly to support every type of client device. The Video Stitcher API re-encodes ad videos to ensure the best quality ads are delivered to a variety of client players. There is a limit of 1000 ads per Google Cloud project.
Every new ad must be encoded before it can be stitched into either a live or VOD session. Expect each ad to be encoded within five minutes. After the ad has been encoded, it can be reused in any number of subsequent sessions. This encoding happens asynchronously and does not require any action to enable or initiate. Due to this encoding time, ads may not be stitched in the first ad break of a live session or in the first VOD session created with the given ad tag.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-07-22 UTC.