Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette page explique comment insérer de manière automatisée des images clés pour les coupures publicitaires dans une vidéo transcodée. L'API Transcoder n'insère ou ne diffuse aucune publicité, et n'arrête pas la lecture des contenus multimédias. Les clients du lecteur vidéo sont responsables du traitement de l'image clé.
Vous pouvez utiliser un outil tel que ffprobe pour vérifier que les images clés ont été insérées. Le résultat suivant montre un exemple de vidéo de sortie sans images clés de coupure publicitaire insérées :
Vous pouvez également consulter le fichier manifeste de sortie pour vérifier que les tags de coupure publicitaire ont été insérés.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (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."]]