[FFmpeg-user] Info
Dan
musicmail at free.fr
Tue Sep 20 21:59:01 EEST 2022
Hi,
I'm trying to run a stream on YouTube a video that loops 24/7, using FFmpeg 4.4 from a server with Ubuntu 22, but cannot succeed, any help would be appreciated.
Here's 2 scripts I made, the 1st one works with a CPU showing around 75% but does not loop.
VBR="1500k"
FPS="24"
QUAL="superfast"
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2"
KEY="mykey"
SOURCE="/home/ubuntu/Video.mp4"
AUDIO_SOURCE="/home/ubuntu/Music.mp3"
ffmpeg \
-re -f lavfi -i "movie=filename=$SOURCE:loop=0, setpts=N/(FRAME_RATE*TB)" \
-thread_queue_size 512 -i "$AUDIO_SOURCE" \
-map 0:v:0 -map 1:a:0 \
-map_metadata:g 1:g \
-vcodec libx264 -pix_fmt yuv420p -preset $QUAL -r $FPS -g $(($FPS * 2)) -b:v $VBR \
-acodec libmp3lame -ar 44100 -threads 6 -qscale:v 3 -b:a 320000 -bufsize 512k \
-f flv "$YOUTUBE_URL/$KEY"
The 2nd script loops but the CPU on the server shows 190% and I loose the "Live" red light on YouTube.
VBR="1500k"
FPS="24"
QUAL="superfast"
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2"
SOURCE="/home/ubuntu/Video.mp4"
KEY="mykey"
ffmpeg \
-stream_loop -1 -i "$SOURCE" -deinterlace \
-vcodec libx264 -pix_fmt yuv420p -preset $QUAL -r $FPS -g $(($FPS * 2)) -b:v $VBR \
-acodec libmp3lame -ar 44100 -threads 6 -qscale 3 -b:a 712000 -bufsize 512k \
-f flv "$YOUTUBE_URL/$KEY"
Thanks.
Dan
More information about the ffmpeg-user
mailing list