https://cloud.google.com/livestream/docs/quickstarts/quickstart-dash#create-input-nodejs

Before you begin

Prerequisites

gcloud init
gcloud projects create PROJECT_ID
gcloud config set project PROJECT_ID
gcloud services enable livestream.googleapis.com
gcloud auth application-default login
gcloud projects add-iam-policy-binding PROJECT_ID --member="user:EMAIL_ADDRESS" --role=roles/livestream.editor
gcloud projects add-iam-policy-binding PROJECT_ID --member="user:EMAIL_ADDRESS" --role=roles/storage.admin

Create a Cloud Storage bucket

gsutil mb gs://BUCKET_NAME # or
gcloud storage buckets create gs://BUCKET_NAME

gsutil iam ch \
    allUsers:objectViewer \
    gs://project-3658

cat > cors.json << 'EOF'
[
  {
    "origin": ["*"],
    "responseHeader": ["Content-Type", "Range"],
    "method": ["GET", "HEAD"],
    "maxAgeSeconds": 3600
  }
]
EOF

gsutil cors set cors.json gs://BUCKET_NAME

Install an encoder

sudo apt install ffmpeg # ubuntu
brew install ffmpeg # mac

Create an input endpoint

Create a channel

Start the channel

Send the input stream

Check that the channel is streaming

Verify the contents in the Cloud Storage bucket

Play the generated live stream

Add an ad break marker to the live stream

Clean up

curl -X GET -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) "https://livestream.googleapis.com/v1/projects/project-3658/locations/asia-east2/channels/lg-uat-channel-1?fields=streamingState"


curl -X GET -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) "https://livestream.googleapis.com/v1/projects/project-3658/locations/asia-east2/inputs/lg-uat-input-1?fields=uri"




ffmpeg -re -f lavfi -i \
    "testsrc=size=1280x720 [out0]; sine=frequency=500 [out1]" \
    -acodec aac -vcodec h264 -f \
    flv rtmp://34.150.119.97/live/b8a8ea2a-fbc9-4362-9014-dc29a737ef84


https://storage.googleapis.com/project-3658/lg-uat-output/manifest.m3u8


ffmpeg -re -f lavfi -i "testsrc=size=1280x720 [out0]; sine=frequency=500 [out1]" \
  -acodec aac -vcodec h264 -f flv "srt://34.150.119.97:4201?streamid=181ed75c-d481-4d1b-9509-83c31d45081e"



https://storage.googleapis.com/project-3658/lg-uat-output/main.mpd

https://storage.googleapis.com/project-3658/lg-uat-output/main.flv