How-to: Stream on Linux


New Member
MOD EDIT: OBS is now available for Linux, see install instructions here:


Hello, so I am one of those who are waiting for Linux version of OBS, however until such time that it is realesed we have an alternative that I will share with you here.

What you will need libav-tools:
1) sudo apt-get install libav-tools // OR
2) I do believe it is in the default repositories, search for it in your software centre.

Once that is done you only need a small script (please note I am not the original creator of this script, I have only added/modified it a bit):
#! /bin/bash

FPS="30" # fps

STREAM_KEY=$(cat ~/.twitch_key)

avconv \
-f x11grab -s $INRES -r "$FPS" -i :0.0 \
-f alsa -ac 2 -i pulse \
-vcodec libx264 -s $OUTRES -preset $QUAL \
-acodec libmp3lame -ar 44100 -threads 4 -qscale 8 -b 712000 -bufsize 8192k -minrate 5120k -maxrate 8192k -ac 2 \
-f flv "rtmp://$STREAM_KEY"

Ok I will try and break down the script and explain a few things:
INRES = in resolution - what resolution should it record at? - Typically this should be the same resolution as your game/screen or close to it.
OUTRES = out resolution - what resolution should it give viewers? - This should also be close to what in resolution you are using.
FPS = Pretty self explainatory, this is the FPS which it will target for the rtmp stream.
QUAL = This one is very important and you will have to play around with it yourself depending on your hardware slow = more CPU usage, but better quality gain || fast = less CPU usage, worse quality - here are some examples of presets with avconv:
ultrafast | superfast | veryfast | faster | fast | placebo | medium | slow | slower | veryslow

Additionally, you can also get a list by doing so:
cat /usr/share/avconv/*.avpreset

STREAM_KEY = This actually just uses the command cat to grab the live_key from a file (which you must create), or you could simply put the live_key direcly inside the streaming program - up to you. Here is an example of the .twitch_key file:
To find your live-key go to: OR for

Next up is the avconv part, really all you may want to change here are:
-threads how many threads does your CPU have? I have an quad-core processor so for me it is 4.
-qscale quality scale - I do believe this goes from 1-10 where 1 is the lowest quality.
-b audio bitrate.
-bufsize video buffer size.
-minrate minimum bitrate for video.
-maxrate maximum bitrate for video.
-ac number of audio channels.

Example of bitrate/buffer size: 1024k, 2048k, 3072k, 4096k, 5120k and so on. You may want to set a higher value if you have a high upload speed (I have 10mbit so I have set mine to 8mbit).

In advance sorry for grammatical errors, English is not my mother tongue. I might add/explain better and fix layout - right now it is really late though and I will go to sleep. There are several other guides out there that are based upon the same method as this, however some uses an old script which no longer works. This has been tested and works on Kubuntu and Ubuntu.

Also, please use the manual (search by holding shift and pressing /):
man avconv

Oh I forgot, you will need to give the script execute permissions:
sudo chmod +x SCRIPTNAME HERE

Hope it helps someone.
Last edited by a moderator:


New Member
That's nice, and I use it. And it works good (except huge non-constant audio/video desync).
But is there any software for Linux that allows dynamically configured overlays/scenes?
I have an A8-3870k 3Ghz with 8GB 1866Mhz RAM, an XFX HD570 and my upload is 5Mbps. My stream is

I did try the various avconv and ffmpeg bash scripts out on the net but all of them resulting in audio desync'ing after only a couple minutes. A lot out of sync. I have looked into avconv, the documentation is very intense but there are a few things your guide is incorrect about. -qscale is one of them. From the documentation
"To have a constant quality (but a variable bitrate), use the option ’-qscale n’ when ’n’ is between 1 (excellent quality) and 31 (worst quality)."
Also you original script only has 1 setting for bitrate and buffer which is being used for both the audio and video, wouldn't you want to control those separately using -b:v and -b:a otherwise if you just have -b 712000 that bitrate will be applied to all stream input is the way I read the avconv documentation.

I have since given up on thesee bash scripts in favor of using simplescreenrecorder. My stream is turning out awesome from what I hear from the 6 viewers I had last night for almost 2 hours. Streaming at 3,500 kb/ps, a 1280x720 windowed game at 30 FPS capturing my audio and my game audio. It was glorious! lol

I have read that obs-studio is being developed and it cross-platform. Can't wait for that or the original osb rewrite.


Any update on this? Did you ever fix the video deysyncing from the audio? That was one problem with OBS I had was the default setting had my lips desynced. To fix the desync in Windows is very easy in OBS (I think it was Mic Time Offset (Milliseconds) -14).

I REALLY want to get off of Windows so badly right now because of (PRISM) because I have a lot of invention ideas, jokes, and books I write that I don't want to get stolen from me before I can copyright them. I am quitting GMAIL for the same reason complying with the NSA bullies.

I would donate, support, and help work on a Ubuntu (linux) version.

Latest KUbuntu:
Than do:

Using Nimaltnet's guide, I'm able to install and play Hots with 60+ FPS on Ubuntu 13.10. You have to download and install Playonlinux for this. With slightly lowered graphical settings this runs very well. Here's the guide:

"The installer kept crashing when I used the installation DVD.
So step one is to download the windows installer from

Then start POL
Goto Tools > Manage Wine versions
Install wine 1.5.26 for x86

Select install
Select install a non-listed program
Create a new virtual drive (I didn't upgrade WOL because I didn't want to ruin my install.

Select use another version of Wine
Select 1.5.26
Choose the 32 bits windows installation
Select the installer

Relax and sit back
Installation took a while but it runs quite smooth.
Play On Linux didn't create an Icon for me. (Just like WOL, just make one manually)"

Here is a link from where I copypasted the above guide:

Again I have yet to install Kubuntu, Ubuntu, Linux, KDE, or anything for that matter. Once I can have confirmed that I can stream to Youtube or Twitch without mic desyncing I will be switching over immediately! I hate Winblows and Crapple!
yes, i figured out the desyncing issues. i now use simplescreenrecorder. i have been streaming to either hitbox or twitch. if you want to know the specific settings just let me know and I can post screenshots and such. it doesn't have webcam support built in, so it can stream your game, the game audio, and using pulseaudio loopbacks it can stream your voice if you have a mic or webcam.

The bad part is that currently there is only 1 external hd capture device that works with linux which is the original hd-pvr and simplescreenrecorder doesn't work with it so currently the only thing you can stream with linux is your desktop, not an external source like an xbox 360 or what not.

I'm praying elgato would release linux drivers but i doubt they will.


New Member
I am one of those who are waiting for Linux version of OBS, however until such time that it is realesed we have an alternative that I will share with you here........................