如何讓 GCP 服務增進影片產生字幕的效率 - NiJia Lin

tags: COSCUP2022 zh-tw Skilled Google開發者派對

歡迎來到 https://hackmd.io/@coscup/2022 共筆

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

點擊本頁上方的 開始用 Markdown 一起寫筆記!
手機版請點選上方 按鈕展開議程列表。

請從這裡開始

\最後一場所以可以大爆講/

Repo: https://github.com/louis70109/GCCP-Creator

為何要做

  • 減少製作影片的 effort
  • CC 字幕可增加被平台看見的機會
  • 想紅 (?)

Scope

* 此專案做 cover 的部分

  • 做影片
  • 逐字稿 *
  • 對時間線 *
  • 輸出 SRT *
  • 校正
  • 成品

Youtube CC 字幕 v.s. 嵌入字幕

優點

  • 可以先出影片再填字幕
  • 方便修改
  • 響應式字幕(螢幕解析度無關)
  • 平台會 index 字幕

缺點

  • 預設關閉,需要請使用者手動開啟
  • 中文觀眾習慣看遷入字幕
  • 特效不夠,不吸睛

Speech to text

Cloud Storage

(UI 圖)

IAM & Role

  • 產生 STT 與 cloud storage 的 JSON 金鑰
  • JSON key 整個 JSON 內容塞進 env var
    • 方便 deploy
    • 也避免 check in JSON 金鑰檔
    • 要手改 JSON 金鑰格式成 valid json
    • runtime 時暫時寫檔給 google client 讀

Cloud Run

git clone https://github.com/louis70109/GCCP-Creator.git
gcloud run deploy <app-name> --source .

會抓 Dockerfile 所以不用其他複雜設定

Trigger: Cloud Run 設定 Eventarc

  • Event: google.cloud.storage.object.v1.finalized of a specific bucket
  • 上傳一個 mp3 檔案

Youtube 上實測

  • 正確率 40% ~ 60%
  • Google STT 1min 以內的影片可能不適合
  • 專有名詞會錯
  • 每個詞都一個 SRT entry XDDD

Video.js

Select a repo