Questa pagina mostra come configurare un progetto Google Cloud e configurare gli account di servizio per accedere al progetto.
Configurare un progetto Google Cloud
Segui questi passaggi per configurare un progetto Google Cloud .
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator
(
roles/resourcemanager.projectCreator
), which contains theresourcemanager.projects.create
permission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
-
Enable the Video Stitcher API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin
), which contains theserviceusage.services.enable
permission. Learn how to grant roles. -
Create a service account:
-
Ensure that you have the Create Service Accounts IAM role
(
roles/iam.serviceAccountCreator
). Learn how to grant roles. -
In the Google Cloud console, go to the Create service account page.
Go to Create service account - Select your project.
-
In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.
In the Service account description field, enter a description. For example,
Service account for quickstart
. - Click Create and continue.
-
Grant the Video Stitcher Admin role to the service account.
To grant the role, find the Select a role list, then select Video Stitcher Admin.
- Click Continue.
-
Click Done to finish creating the service account.
Do not close your browser window. You will use it in the next step.
-
Ensure that you have the Create Service Accounts IAM role
(
-
Create a service account key:
- In the Google Cloud console, click the email address for the service account that you created.
- Click Keys.
- Click Add key, and then click Create new key.
- Click Create. A JSON key file is downloaded to your computer.
- Click Close.
-
Set the environment variable
GOOGLE_APPLICATION_CREDENTIALS
to the path of the JSON file that contains your credentials. This variable applies only to your current shell session, so if you open a new session, set the variable again. -
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator
(
roles/resourcemanager.projectCreator
), which contains theresourcemanager.projects.create
permission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
-
Enable the Video Stitcher API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin
), which contains theserviceusage.services.enable
permission. Learn how to grant roles. -
Create a service account:
-
Ensure that you have the Create Service Accounts IAM role
(
roles/iam.serviceAccountCreator
). Learn how to grant roles. -
In the Google Cloud console, go to the Create service account page.
Go to Create service account - Select your project.
-
In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.
In the Service account description field, enter a description. For example,
Service account for quickstart
. - Click Create and continue.
-
Grant the Video Stitcher Admin role to the service account.
To grant the role, find the Select a role list, then select Video Stitcher Admin.
- Click Continue.
-
Click Done to finish creating the service account.
Do not close your browser window. You will use it in the next step.
-
Ensure that you have the Create Service Accounts IAM role
(
-
Create a service account key:
- In the Google Cloud console, click the email address for the service account that you created.
- Click Keys.
- Click Add key, and then click Create new key.
- Click Create. A JSON key file is downloaded to your computer.
- Click Close.
-
Set the environment variable
GOOGLE_APPLICATION_CREDENTIALS
to the path of the JSON file that contains your credentials. This variable applies only to your current shell session, so if you open a new session, set the variable again. -
Install the Google Cloud CLI.
-
Se utilizzi un provider di identità (IdP) esterno, devi prima accedere a gcloud CLI con la tua identità federata.
-
Per inizializzare gcloud CLI, esegui questo comando:
gcloud init
- Utilizza gcloud CLI per testare l'ambiente di autenticazione.
Verifica che il seguente comando restituisca una stringa di testo senza errori:
gcloud auth application-default print-access-token
- Nel terminale, imposta il progetto attivo per i comandi gcloud. Sostituisci
YOUR_PROJECT_ID
con l'ID progetto.gcloud config set project YOUR_PROJECT_ID
- Attiva il account di servizio. Sostituisci
PATH_TO_YOUR_SERVICE_KEY
con il percorso del file JSON che hai scaricato nella macchina locale.gcloud auth activate-service-account --key-file PATH_TO_YOUR_SERVICE_KEY
-
Ensure that you have the Create Service Accounts IAM role
(
roles/iam.serviceAccountCreator
). Learn how to grant roles. -
In the Google Cloud console, go to the Create service account page.
Go to Create service account - Select your project.
-
In the Service account name field, enter a name. The Google Cloud console fills in the Service account ID field based on this name.
In the Service account description field, enter a description. For example,
Service account for quickstart
. - Click Create and continue.
-
Grant the Video Stitcher User role to the service account.
To grant the role, find the Select a role list, then select Video Stitcher User.
- Click Continue.
-
Click Done to finish creating the service account.
Do not close your browser window. You will use it in the next step.
- In the Google Cloud console, click the email address for the service account that you created.
- Click Keys.
- Click Add key, and then click Create new key.
- Click Create. A JSON key file is downloaded to your computer.
- Click Close.
- Accedi a Google Ad Manager (GAM).
- Fai clic su Amministratore > Impostazioni globali.
- Assicurati che l'accesso API sia abilitato.
- Fai clic su Aggiungi utente con account di servizio.
- Compila il modulo, incluso l'indirizzo email dell'account di servizio creato in precedenza.
- Seleziona un ruolo che deve includere l'autorizzazione Gestire i contenuti video con l'inserimento di annunci dinamici dallo strumento di stitching video di Google Cloud. Devi
creare un ruolo personalizzato
denominato Live Stream Manager specifico per la gestione di questo account di servizio. Il ruolo personalizzato deve disporre almeno delle seguenti autorizzazioni:
- Gestire i contenuti video con l'inserimento di annunci dinamici dallo strumento di stitching video di Google Cloud
- Visualizzare creatività (richiesto dall'autorizzazione precedente)
- Visualizzare contenuti video, pacchetti e metadati
- Visualizzare le origini di contenuto
- Se la tua rete Ad Manager utilizza i team, devi assegnare il team "Tutte le entità" all'utente dell'account di servizio.
- Fai clic su Salva e conferma l'aggiunta dell'account di servizio.
- Il formato del contenitore può essere:
- MPEG-TS muxed
- MPEG-TS demultiplexato
- FMP4 demuxed
- Almeno un rendering nel manifest con i seguenti campi (compilati
correttamente):
- codec
- larghezza di banda
MPD@type
impostato su dinamico (@type="dynamic"
)MPD@profiles
include il profilo ISO Liveurn:mpeg:dash:profile:isoff-live:2011
- Deve essere composto da più periodi, ognuno dei quali deve contenere uno o più set di adattamento
- Ogni Adaptation Set contiene una o più rappresentazioni
- Le rappresentazioni contengono o ereditano un
SegmentTemplate
con l'identificatore$Number$
o$Time$
@segmentAlignment
impostato su true per tutti i set di adattamento- Le rappresentazioni non devono essere vuote
Attivare il account di servizio
Utilizzerai questo account di servizio per autorizzare l'accesso e chiamare l'API Video Stitcher.
Crea un account di servizio con le sole autorizzazioni per creare sessioni
Poiché un token OAuth verrà trasmesso a un'applicazione client, crea un account di servizio separato con solo le autorizzazioni per creare una sessione. In questo modo, un token OAuth compromesso non può compromettere le tue risorse, come le configurazioni VOD/live o le chiavi CDN.
Create a service account:
Create a service account key:
Configurazione del live streaming
Se inserisci annunci in un live streaming, segui i passaggi descritti in questa sezione (o consulta i passaggi per i VOD).
Collegare l'account di servizio all'account Ad Manager
Una volta creato il account di servizio, devi collegarlo al tuo account Ad Manager. Ciò consente all'API Video Stitcher di creare eventi di live streaming per tuo conto. Per farlo, segui i passaggi per concedere l'accesso al tuo account di servizio:
Creare un live streaming
Puoi utilizzare uno degli avvii rapidi dell'API Live Stream per configurare un live streaming. Sono supportati sia i live streaming HLS che MPEG-DASH (vedi i requisiti del manifest di origine). Questa procedura è facoltativa; puoi utilizzare un live streaming esistente.
Le guide rapide dell'API Live Stream utilizzano le credenziali predefinite dell'applicazione per l'autenticazione, ma puoi utilizzare il account di servizio che hai già configurato. Per questa opzione, assicurati che il account di servizio abbia il ruolo Editor live streaming.
Assicurati di mantenere attivo il live streaming. Non seguire i passaggi della sezione Pulizia finché non hai terminato il live streaming.
Requisiti del manifest di origine
L'API Video Stitcher registra la configurazione con Ad Manager analizzando il manifest di origine. Il manifest di origine deve avere determinate caratteristiche a seconda del formato.
HLS
MPEG-DASH
Configurazione dello stream VOD
Se inserisci annunci in uno stream VOD, segui i passaggi descritti in questa sezione (o consulta i passaggi per un live streaming).
Crea i file di origine VOD
Questo flusso di lavoro richiede un file manifest MPEG-DASH (MPD) o un file manifest HTTP Live Streaming (HLS) (M3U8) e i file di segmento associati. Puoi utilizzare i tuoi file VOD esistenti oppure creare file sorgente VOD utilizzando l'API Transcoder.