Cannot get to 30fps when livestream with ffmpeg + xvfb

0

I'm using this ffmpeg command on my dedicated server and it works fine, video sent at 30fps

ffmpeg -framerate 30 -s 854x480 -draw_mouse 0 -f x11grab -i :1009.0+nomouse -f pulse -i default -c:v libx264 -g 60 -r 30 -bufsize 2M -b:v 10M -vbsf h264_mp4toannexb -pix_fmt yuv420p -crf 18 -preset veryfast -c:a aac -af aresample=async=1 -b:a 128k -bsf:a aac_adtstoasc -metadata comment=3a89016c-fb96-45eb-978b-1e5debade01d -f flv "rtmp://....."

Now, I'm trying to move my code to aws ec2. The same command I only got 20-25 fps and it made my livestream get lag. Check screenshot here : https://i.imgur.com/7kbw4Jd.png

I checked top command and CPU still fine. Check : https://i.imgur.com/gacMkED.png

I have no idea why the ffmpeg command can't get to 30fps. Please help. Thanks

Edited by: viennt on Apr 27, 2021 7:27 PM

viennt
已提问 3 年前405 查看次数
2 回答
0

fixed

viennt
已回答 3 年前
0

For anyone revisiting this problem i would recommend on EC2, to try AWS G4dn or G5g instances. And enable hardware acceleration with FFmpeg. We are doing it ourselves and results are amazing. I wrote a simple step-by-step guide for people like me trying to bring the best out of FFmpeg with limited budget. https://mirzabilal.com/how-to-install-ffmpeg-with-harware-accelaration-on-aws

profile picture
Mirza
已回答 7 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则