File: stream-facebook.sh

package info (click to toggle)
voctomix 1.3-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 3,368 kB
  • sloc: python: 4,958; sh: 733; makefile: 23
file content (30 lines) | stat: -rw-r--r-- 858 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh

# Best Practices: https://developers.facebook.com/docs/videos/live-video/best-practices/

# It may be possible to auto-gen the API key: https://developers.facebook.com/docs/graph-api/reference/live-video/
#   "You can make a POST request to live_videos edge from the following paths"

# -t 14400 Limit to 4 hour segment as Facebook API specifies
# -g 60  Keyframe interval - every 2 seconds

FACEBOOKURL="rtmp://live-api-a.facebook.com:80/rtmp/"
echo "Enter your Facebook Live Streaming Key"
read STREAMKEY

ffmpeg -y -nostdin \
	-thread_queue_size 512 \
	-timeout 3000000 \
	-i tcp://localhost:11000 \
	-t 14400 \
	-strict -2 \
	-c:a aac -ac 1 -ar 48000 -b:a 128k \
	-c:v libx264 \
	-preset medium \
	-pix_fmt yuv420p \
	-r 30 \
	-g 60 \
	-vb 2048k -minrate 2000k -maxrate 4000k \
	-bufsize 4096k -threads 2  \
	-f flv 	"$FACEBOOKURL$STREAMKEY"