FFMPEG to Youtube Live

心已入冬 提交于 2019-12-20 14:54:17

问题


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

But im getting the following message on youtube,

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

Any one know how to fix it ?

Helps would be appreciated.


回答1:


So i have a solution.

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

The important parts are the

-re

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

-framerate 2

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

Hoped this helped!

Edit 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

Changed to H.264 Codex Fixed that problem

-g 2

This fixes the final buffering issue.



来源:https://stackoverflow.com/questions/43586435/ffmpeg-to-youtube-live

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!