Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questa pagina spiega come inserire tramite programmazione i fotogrammi chiave per le interruzioni pubblicitarie in un video transcodificato. L'API Transcoder non inserisce né riproduce annunci né interrompe la riproduzione dei contenuti multimediali. I client dei video player sono responsabili della gestione del keyframe.
La seguente configurazione REST/JSON inserisce i keyframe dell'interruzione pubblicitaria a 4, 7 e 11 secondi nella sequenza temporale del video di output:
Puoi utilizzare uno strumento come
ffprobe per verificare che i
keyframe siano stati inseriti. Il seguente output mostra un video di output di esempio
senza keyframe dell'interruzione pubblicitaria inseriti:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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."]]