FFMPEG转Youtube直播 [英] FFMPEG to Youtube Live

查看:574
本文介绍了FFMPEG转Youtube直播的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个音频流,我通过以下命令使用ffmpeg将其流化为youtube,并以图片作为背景,

I have an audio stream, im using ffmpeg to stream it to youtube live with an image as background with following command,

ffmpeg -loop 1 -i x.jpg -i http://xxx.xxx.xxx.xxxx:5305/stream -c:a aac -s 1280x720 -ab 128k -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/xxxxx

但是我在youtube上收到了以下消息,

But im getting the following message on youtube,

YouTube is not receiving enough video to maintain smooth streaming. As such, viewers will experience buffering 这会在输出流中造成缓冲.

YouTube is not receiving enough video to maintain smooth streaming. As such, viewers will experience buffering this cause buffering in the output stream.

有人知道如何解决吗?

帮助将不胜感激.

推荐答案

所以我有解决方案.

ffmpeg -re -loop 1 -framerate 2 -i test1.jpg -i https://xxxxxxx:8443/live.ogg -c:a aac -s 2560x1440 -ab 128k -maxrate 2048k -bufsize 2048k -framerate 30 -g 60 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/xxxxxxxxxxxxx

重要的部分是

-re

-re

一开始处理缓冲问题.
然后

at the start which deals with a buffering issue.
Then the

帧速率2

-framerate 2

在循环1"和图像之间.这行得通,而且我得到了一个良好的干净高质量流,该流不会缓冲.

between the "-loop 1" and the image. This works and i get a good clean high quality stream that does not buffer.

希望这对您有所帮助!

编辑1

ffmpeg -re -loop 1 -framerate 2 -i test1.jpg -i https://xxxxxxxxxxx:8443/live.ogg -c:a aac -s 2560x1440 -ab 128k -vcodec libx264 -pix_fmt yuv420p -maxrate 2048k -bufsize 2048k -framerate 30 -g 2 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/xxxxxxxxxxxxx

好,因此此更新的版本应该可以解决流中几乎所有的问题.

Ok So this updated version should fix almost all problems with the stream.

-vcodec libx264 -pix_fmt yuv420p

-vcodec libx264 -pix_fmt yuv420p

更改为H.264 Codex修复了该问题

Changed to H.264 Codex Fixed that problem

-g 2

-g 2

这解决了最终的缓冲问题.

This fixes the final buffering issue.

这篇关于FFMPEG转Youtube直播的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆