3
Using OBS and ffmpeg, I'm attempting to stream to both Facebook and Twitch at the same time. My current setup works, however the issue is it's a tad resource hungry.
FACEBOOK_KEY="123?ds=1\&s_l=1\&a=ggnore"
TWITCH_KEY="live_123_aBcEdFg"
ARGS="-c:v libx264 -preset medium -maxrate 3500k -bufsize 6000k -pix_fmt yuv420p -g 50 -c:a aac -b:a 160k -ac 2 -ar 44100 -f flv"
CMD="ffmpeg -re -listen 1 -i rtmp://127.0.0.1:5555"
CMD="$CMD $ARGS rtmp://live.twitch.tv/app/$TWITCH_KEY"
CMD="$CMD -r 30 $ARGS rtmp://rtmp-api.facebook.com:80/rtmp/$FACEBOOK_KEY"
eval $CMD
OBS settings are straight forward:
Video: 720p, 2500k bitrate, x264 encoding, 60FPS
Audio: 160k AAC.
I have two goals I'm trying to accomplish with the setup.
- For Twitch, ffmpeg should simply just be copying the source stream from OBS to Twitch without any conversion, as Twitch accepts what I'm passing from OBS.
- For Facebook, it should convert the FPS from 60 to 30, again with the minimal resource usage as Facebook accepts everything coming from OBS other then the FPS.
Fantastic! Thanks. Would you do anything else to the Facebook stream to reduce CPU usage? Anything you feel isn't needed? – Dustin – 2017-07-10T13:33:59.797
2@Dustin Output 30 fps from OBS and then feed that to both Facebook and Twitch without re-encoding. – llogan – 2017-07-17T22:29:22.770