如何使用FFmpeg设置从Icecast到YouTube Live的连续流?

问题描述 投票:3回答:1

当Icecast服务器关闭时,FFmpeg尝试重新连接,但只有一次尝试。这是我得到的错误和我的脚本。

[http @ 0x556612e43f80] Stream ends prematurely at 4040716, should be 1844674407370955161597x
[http @ 0x556612e43f80] Will reconnect at 4040716 error=Input/output error.
[tcp @ 0x7fe10400b7a0] Connection to tcp://185.195.26.99:8000 failed: Connection refused
[http @ 0x556612e43f80] Failed to reconnect at 0.
185.195.26.99:8000/radio: Input/output error1:40.96 bitrate=2878.3kbits/s speed=0.997x

在继续播放后,YouTube并没有中断实时翻译,但它变成了空白。

#!/bin/bash

image=../pic/1.jpg #path to image
source=http://***.**.**.**:8000/radio #radio stream as source
youtube_url=rtmp://a.rtmp.youtube.com/live2 #rtmp://a.rtmp.youtube.com/live2
youtube_key=****-****-*****-****
resolution=1920x1080 #stream resolution

###########################################################

stream=FFREPORT=file=../log/stream-%t.log:level=32 ffmpeg \
        -thread_queue_size 1024 \
        -reconnect 1 -reconnect_at_eof 1 -reconnect_streamed 1 -reconnect_delay_max 3600 -i $source \
        -re -loop 1 -i $image \
        -acodec aac -b:a 128k -ar 44100 -strict experimental \
        -vcodec libx264 -preset ultrafast -tune stillimage -r 30 -g 60 -b:v 4500k -minrate 4000k -maxrate 4500k -bufsize 6000k \
        -s $resolution \
        -f flv \
        $youtube_url/$youtube_key\

until $stream ; do
        echo "Restarting stream ..."
        sleep 2
done
ffmpeg youtube stream live icecast
1个回答
0
投票

我已经准备好我正在使用的脚本的github存储库以及说明

https://github.com/hikikomorime/openplayer

© www.soinside.com 2019 - 2024. All rights reserved.