-
Notifications
You must be signed in to change notification settings - Fork 0
Page 2 Streaming your Desktop on Twitch.com
To understand this part, make sure you read the previous tutorial about how to make videos of your desktop with ffmpeg
. If you don't, just take a moment to understand the input options of ffmpeg
before continuing this tutorial.
Previously, i shown you how to make a desktop video, and all the input options I used to make it. Now, we need to put output options to encode our desktop video into a supported format by RTMP
(Real Time Messaging Protocol) to stream on Twitch.com
.
RTMP
uses flv
(Flash Video) video format, MPEG4
video codec, and mp3
audio codec. Actually the configuration we need to make is something like :
DESKTOP----INPUT---->PULSE>----OUTPUT---->TWITCH
Just like previously we'll start with the input options, to finish with the output options, and the path where I want my streaming to be run.
To stream on Twitch.com
, you may need your Twitch Stream Key
. You can find it easily in your account settings section.
Let start streaming on Twitch.com :
ffmpeg -f x11grab -s 1920x1080 -r 30 -i :0.0 \
-f alsa -i pulse -vcodec libx264 \
-s 1280x720 -acodec libmp3lame -ac 2 \
-ab 128k -ar 44100 -threads 0 \
-f flv "rtmp://live.twitch.tv/app/your_stream_key"
Press Q
to stop streaming.
As we saw previously all input options, I'll only detail the output options in this section :
-
-s 1280x720
is the output video size. It means that the video will be streamed to twitch in720p
. -
-acodec libmp3lame
is an outputmp3
codec.RTMP
needs this codec to run. -
-ac 2
audio channels (Stereo). -
-ab 128k
an audio bitstream filter. -
-ar 44100
Audio Sampling Frequency. By default this value is 48000Hz. ButRTMP
doesn't support more than 44100. -
-threads 0
processors used for encoding. By default0
means that you allow ffmpeg to use all the power of your processor to encode if needed. -
-f flv
here I force the output format inflv
, which is supported byRTMP
. The rest is the path to Twitch. Just put you 'Twitch Stream Key` at the end to stream under your Twitch account.
WARNING : never give your Twitch Stream Key
it's personnal.
Now, you just need to load Twitch.com page, looking for your account and watch what you're streaming. It works!
Don't forget to stop streaming pressing Q
on your terminal.
You know how to stream your Xserver (or desktop) on Twitch.com
. In another Tutorial, I'll will show you how to configure Nginx
to make a Streaming Server at house using VLC
to watch the flow.
Thank you for attending this tutorial.
Best regards.
pixhub.