Stay organized with collections
Save and categorize content based on your preferences.
This page explains how to programmatically insert keyframes for ad breaks in a
transcoded video. The Transcoder API does not insert or play ads, or
stop media playback; video player clients are responsible for handling the
keyframe.
You can use a tool like
ffprobe to verify that the
keyframes were inserted. The following output shows a sample output video
without ad break keyframes inserted:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[],[],null,["# Inserting ad breaks\n\nThis page explains how to programmatically insert keyframes for ad breaks in a\ntranscoded video. The Transcoder API does not insert or play ads, or\nstop media playback; video player clients are responsible for handling the\nkeyframe.\n\nUse the [`adBreaks`](/transcoder/docs/reference/rest/v1/JobConfig) array to\ninsert\n[ad break keyframes](/transcoder/docs/reference/rest/v1/JobConfig#adbreak)\nin the output video. You can add this configuration to a\n[job template](/transcoder/docs/how-to/job-templates) or include it in an\n[ad-hoc job configuration](/transcoder/docs/how-to/jobs#create_jobs_ad_hoc).\n\nThe following REST/JSON configuration inserts ad break keyframes at 4, 7, and 11\nseconds in the timeline of the output video: \n\n \"adBreaks\": [\n {\n \"startTimeOffset\": \"4s\"\n },\n {\n \"startTimeOffset\": \"7s\"\n },\n {\n \"startTimeOffset\": \"11s\"\n }\n ],\n\nYou can use a tool like\n[`ffprobe`](https://ffmpeg.org/ffprobe.html) to verify that the\nkeyframes were inserted. The following output shows a sample output video\n*without* ad break keyframes inserted: \n\n $ ffprobe -loglevel error -skip_frame nokey -select_streams v:0 -show_entries \\\n frame=pkt_pts_time -of csv=print_section=0 hd.mp4\n 0.000000\n 3.000000\n 6.000000\n 9.000000\n 12.000000\n ...\n\nThe following output shows the same output video timeline with ad break\nkeyframes inserted: \n\n $ ffprobe -loglevel error -skip_frame nokey -select_streams v:0 -show_entries \\\n frame=pkt_pts_time -of csv=print_section=0 hd.mp4\n 0.000000\n 3.000000\n 4.000000 \u003c\u003c\u003c Inserted keyframe here\n 6.000000\n 7.000000 \u003c\u003c\u003c Inserted keyframe here\n 9.000000\n 11.000000 \u003c\u003c\u003c Inserted keyframe here\n 12.000000\n ...\n\nYou can also check the output\n[manifest file](/transcoder/docs/reference/rest/v1/JobConfig#manifest) to\nverify that the ad break tags were inserted."]]