Featured image of post Use ffmpeg to push the live streaming video to YouTube.

Use ffmpeg to push the live streaming video to YouTube.

📌 Introduction

You can push the live streaming video of YouTube using ffmpeg commands.

可以透過 ffmpeg 的指令來進行 YouTube 的直播串流畫面推送。

💻 Code

Create a file named yt-push.sh and paste the following content into it.

請建立一個 yt-push.sh 檔案並貼上下列內容。

#!/bin/sh

# Usage: ./yt-push.sh <SOURCE> <KEY>

ffmpeg -re -i "$1" -vcodec copy -acodec copy -f flv "rtmp://x.rtmp.youtube.com/live2/$2"

📖 Ref.

itgoyo/ffmpeg-push: ffmpeg实现24小时不间断推流

Stream video to youtube via ffmpeg

 

Licensed under CC BY-NC-SA 4.0
Last updated on Nov 15, 2023 14:46 CST