Donkey Kong Forum

Streaming => General Streaming Discussion => Topic started by: johnbart on November 24, 2013, 11:21:53 am

Title: Twitch Streaming for Linux
Post by: johnbart on November 24, 2013, 11:21:53 am
I'm not sure if there are any other Linux users here but I got Mame streaming fairly decently on my laptop running Linux mint using the following bash script if it helps anyone else out.

-j
-----------------------------------

#! /bin/bash

FPS="30"                                                    # target FPS
QUAL="libx264-ipod640"                            # one of the many FFMPEG preset on (k)ubuntu found in /usr/share/ffmpeg

# Get Game Window
echo "Click, with the mouse, on the Window that you want to Stream"
rm -f twitch_tmp 2> /dev/null
xwininfo -stats >> twitch_tmp
TOPXY=$(cat twitch_tmp | awk 'FNR == 8 {print $4}')","$(cat twitch_tmp | awk 'FNR == 9 {print $4}')
INRES=$(cat twitch_tmp | awk 'FNR == 12 {print $2}')"x"$(cat twitch_tmp | awk 'FNR == 13 {$2=$2+0+10; print $2}')
rm -f twitch_tmp 2> /dev/null
echo " "

STREAM_KEY=<YourKeyHere>

ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0+$TOPXY -f alsa -ac 2 -i pulse -vcodec libx264 -vpre "$QUAL" -crf 30 -x264opts keyint=50:min-keyint=20 -s $INRES -acodec libmp3lame -ar 22050 -threads 4 -qscale 5 -b 712000 -f flv "rtmp://live.justin.tv/app/$STREAM_KEY"

------------------------------


Title: Re: Twitch Streaming for Linux
Post by: Scoundrl on November 24, 2013, 03:07:08 pm
I'm not sure if there are any other Linux users here but I got Mame streaming fairly decently on my laptop running Linux mint using the following bash script if it helps anyone else out.

-j
-----------------------------------

#! /bin/bash

FPS="30"                                                    # target FPS
QUAL="libx264-ipod640"                            # one of the many FFMPEG preset on (k)ubuntu found in /usr/share/ffmpeg

# Get Game Window
echo "Click, with the mouse, on the Window that you want to Stream"
rm -f twitch_tmp 2> /dev/null
xwininfo -stats >> twitch_tmp
TOPXY=$(cat twitch_tmp | awk 'FNR == 8 {print $4}')","$(cat twitch_tmp | awk 'FNR == 9 {print $4}')
INRES=$(cat twitch_tmp | awk 'FNR == 12 {print $2}')"x"$(cat twitch_tmp | awk 'FNR == 13 {$2=$2+0+10; print $2}')
rm -f twitch_tmp 2> /dev/null
echo " "

STREAM_KEY=<YourKeyHere>

ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0+$TOPXY -f alsa -ac 2 -i pulse -vcodec libx264 -vpre "$QUAL" -crf 30 -x264opts keyint=50:min-keyint=20 -s $INRES -acodec libmp3lame -ar 22050 -threads 4 -qscale 5 -b 712000 -f flv "rtmp://live.justin.tv/app/$STREAM_KEY"

------------------------------

And people think getting everyday things to work in Linux is to much work...
Title: Re: Twitch Streaming for Linux
Post by: johnbart on November 25, 2013, 12:46:54 am
As a trade off for the hard work getting things running in Linux you get a free pocket protector so it all works out :)
Title: Re: Twitch Streaming for Linux
Post by: SQUIIDUX on December 02, 2013, 04:26:04 am
i use linux and stream from a script as well. i have it so my webcam is in the top right corner as well.
Title: Re: Twitch Streaming for Linux
Post by: johnbart on December 02, 2013, 05:09:33 am
Nice.  Mind sharing the script for the webcam part?  I was going to start playing with things to make that happen too.
Title: Re: Twitch Streaming for Linux
Post by: Scoundrl on December 02, 2013, 03:56:00 pm
Right click. Add source. Pick camera. Grab corner of screen to resize. Click broadcast.
Title: Re: Twitch Streaming for Linux
Post by: johnbart on December 02, 2013, 11:45:48 pm
Ken, don't be jealous of the real computer men.  We'll let you join the dark side.  Just put down that old dusty floppy with Win98 on it we'll warmly welcome you :)
Title: Re: Twitch Streaming for Linux
Post by: Scoundrl on December 03, 2013, 12:07:08 am
In the windows world we use flash drives now, and we dont even need scripts to get them accessible!