En esta página se explica cómo configurar un Google Cloud proyecto y configurar cuentas de servicio para acceder a él.
Configurar un Google Cloud proyecto
Sigue estos pasos para configurar un Google Cloud proyecto.
- 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.
-
Si utilizas un proveedor de identidades (IdP) externo, primero debes iniciar sesión en la CLI de gcloud con tu identidad federada.
-
Para inicializar gcloud CLI, ejecuta el siguiente comando:
gcloud init
- Usa la CLI de gcloud para probar tu entorno de autenticación.
Comprueba que el siguiente comando genere una cadena de texto sin errores:
gcloud auth application-default print-access-token
- En tu terminal, define el proyecto activo para los comandos de gcloud. Sustituye
YOUR_PROJECT_ID
por el ID de tu proyecto.gcloud config set project YOUR_PROJECT_ID
- Activa la cuenta de servicio. Sustituye
PATH_TO_YOUR_SERVICE_KEY
por la ruta al archivo JSON que has descargado en tu máquina local.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.
- Inicie sesión en Google Ad Manager (GAM).
- Haga clic en Administrar > Configuración global.
- Asegúrate de que Acceso a la API esté habilitado.
- Haga clic en Añadir un usuario de cuenta de servicio.
- Rellene el formulario, incluida la dirección de correo de la cuenta de servicio que ha creado anteriormente.
- Selecciona un rol que incluya el permiso Gestionar contenido de vídeo con la inserción dinámica de anuncios de Google Cloud Video Stitcher. Debería crear un rol personalizado
llamado Gestor de emisiones en directo específicamente para gestionar esta cuenta de servicio. El rol personalizado debe tener al menos los siguientes permisos:
- Gestionar contenido de vídeo con la inserción dinámica de anuncios de Google Cloud Video Stitcher
- Ver creatividades (obligatorio para el permiso anterior)
- Ver contenido, conjuntos de contenido y metadatos de vídeo
- Ver fuentes de contenido
- Si su red de Ad Manager usa equipos, debe asignar el equipo "Todas las entidades" al usuario de la cuenta de servicio.
- Haga clic en Guardar y confirme que quiere añadir la cuenta de servicio.
- El formato del contenedor puede ser:
- MPEG-TS multiplexado
- MPEG-TS sin multiplexar
- FMP4 sin multiplexar
- Al menos una representación en el archivo de manifiesto con los siguientes campos (rellenados correctamente):
- códecs
- bandwidth
MPD@type
definido como dinámico (@type="dynamic"
)MPD@profiles
incluye el perfil ISO Liveurn:mpeg:dash:profile:isoff-live:2011
- Debe tener varios periodos, y cada periodo debe contener uno o varios AdaptationSets.
- Cada Adaptation Set contiene una o varias Representations
- Las representaciones contienen o heredan un
SegmentTemplate
con el identificador$Number$
o$Time$
. @segmentAlignment
se ha definido como true para todos los conjuntos de adaptación- Las representaciones no pueden estar vacías
Activar la cuenta de servicio
Usarás esta cuenta de servicio para autorizar el acceso y llamar a la API Video Stitcher.
Crear una cuenta de servicio con permisos para crear sesiones
Como se va a enviar un token de OAuth a una aplicación cliente, crea una cuenta de servicio independiente con permisos únicamente para crear una sesión. De esta forma, si se filtra un token de OAuth, no se pondrán en peligro tus recursos, como las configuraciones de VOD o de contenido en directo, ni las claves de CDN.
Create a service account:
Create a service account key:
Configuración de la emisión en directo
Si vas a insertar anuncios en una emisión en directo, sigue los pasos de esta sección (o consulta los pasos para el VOD).
Vincular la cuenta de servicio con la cuenta de Ad Manager
Una vez creada la cuenta de servicio, debe vincularla a su cuenta de Ad Manager. Esto permite que la API Video Stitcher cree eventos de emisión en directo en tu nombre. Para ello, sigue los pasos para conceder acceso a tu cuenta de servicio:
Crear una emisión en directo
Puedes usar una de las guías de inicio rápido de la API Live Stream para configurar una emisión en directo. Se admiten las emisiones en directo HLS y MPEG-DASH (consulta los requisitos del archivo de manifiesto de origen). Este procedimiento es opcional. Puedes usar tu propia emisión en directo.
En las guías de inicio rápido de la API Live Stream se usan las credenciales predeterminadas de la aplicación para la autenticación, pero puedes usar la cuenta de servicio que ya hayas configurado. Para esta opción, asegúrate de que la cuenta de servicio tenga el rol Editor de transmisiones en directo.
Asegúrate de que la emisión en directo siga activa. No sigas los pasos de la sección Limpiar hasta que hayas terminado con la emisión en directo.
Requisitos del manifiesto de origen
La API Video Stitcher registra la configuración en Ad Manager analizando el manifiesto de origen. El archivo de manifiesto de origen debe tener ciertas características en función del formato.
HLS
MPEG-DASH
Configuración de flujos de VOD
Si va a insertar anuncios en una emisión de vídeo bajo demanda, siga los pasos que se indican en esta sección (o consulte los pasos para una emisión en directo).
Crear los archivos de origen de VOD
Este flujo de trabajo requiere un archivo de manifiesto MPEG-DASH (MPD) o un archivo de manifiesto HTTP Live Streaming (HLS) (M3U8), así como los archivos de segmento asociados. Puedes usar tus propios archivos VOD o crear archivos de origen VOD con la API Transcoder.