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

0 Members and 1 Guest are viewing this topic.

Offline johnbart

  • Full Member
  • *
  • Posts: 88
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"

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


DKF Blogger

Offline Scoundrl

  • Elite Member
  • *
  • Posts: 275
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...
Twitch TV  Streamer

Offline johnbart

  • Full Member
  • *
  • Posts: 88
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 :)
DKF Blogger

Offline SQUIIDUX

  • Full Member
  • *
  • Posts: 92
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.
Twitch TV  Streamer

Offline johnbart

  • Full Member
  • *
  • Posts: 88
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.
DKF Blogger

Offline Scoundrl

  • Elite Member
  • *
  • Posts: 275
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.
Twitch TV  Streamer

Offline johnbart

  • Full Member
  • *
  • Posts: 88
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 :)
DKF Blogger

Offline Scoundrl

  • Elite Member
  • *
  • Posts: 275
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!
Twitch TV  Streamer