Author Topic: Twitch Streaming for Linux  (Read 11699 times)

0 Members and 1 Guest are viewing this topic.

Offline johnbart

  • Senior Member
  • *
  • Posts: 232
    • Awards
Twitch Streaming for Linux
« 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"

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


Member for 11 Years CAGTournaments.com Founder Blogger Twitch Streamer

Offline Scoundrl

  • Elite Member
  • *
  • Posts: 343
    • Awards
Re: Twitch Streaming for Linux
« Reply #1 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...
Member for 11 Years IGBY 2015 DKF Team Member Blogger Twitch Streamer

Offline johnbart

  • Senior Member
  • *
  • Posts: 232
    • Awards
Re: Twitch Streaming for Linux
« Reply #2 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 :)
Member for 11 Years CAGTournaments.com Founder Blogger Twitch Streamer

SQUIIDUX

  • Guest
Re: Twitch Streaming for Linux
« Reply #3 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.

Offline johnbart

  • Senior Member
  • *
  • Posts: 232
    • Awards
Re: Twitch Streaming for Linux
« Reply #4 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.
Member for 11 Years CAGTournaments.com Founder Blogger Twitch Streamer

Offline Scoundrl

  • Elite Member
  • *
  • Posts: 343
    • Awards
Re: Twitch Streaming for Linux
« Reply #5 on: December 02, 2013, 03:56:00 pm »
Right click. Add source. Pick camera. Grab corner of screen to resize. Click broadcast.
Member for 11 Years IGBY 2015 DKF Team Member Blogger Twitch Streamer

Offline johnbart

  • Senior Member
  • *
  • Posts: 232
    • Awards
Re: Twitch Streaming for Linux
« Reply #6 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 :)
Member for 11 Years CAGTournaments.com Founder Blogger Twitch Streamer

Offline Scoundrl

  • Elite Member
  • *
  • Posts: 343
    • Awards
Re: Twitch Streaming for Linux
« Reply #7 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!
Member for 11 Years IGBY 2015 DKF Team Member Blogger Twitch Streamer