Sunday, 20 October 2013

Twitch Streamer for Linux

This Screenshot comes from a linux streaming session.


Since my friend asked me to help him to stream on twitch.tv from linux, i've decided to write something really user-friendly that can be used by everyone. so here it is: Twitch-Streamer-Linux (github)
This little script allows you to stream on Twitch like the non-free apps on windows. You can choose the quality and if stream with the webcam or not.

There is an HOW-TO on the Readme (LINK). if you have any question, just write here or on github.

have fun!

[UPDATE 1]

i have added also some flags to get "Excellent" as quality on Twitch. now works as good as non-free programs :D

20 comments:

  1. Hey there! Thanks for your script, been looking for a streaming solution for Linux. I can't seem to put it to work though, I have this error coming up when I try:


    Please setup the Audio Output (something like 'pavucontrol')

    Webcam NOT found!! (/dev/video1)
    You should be online! Check on http://twitch.tv/ (Press CTRL+C to stop)
    ./twitch.sh: line 79: avconv: command not found

    Stopping Audio (Don't worry if you see errors here)
    Failed to unload module: Module module-null-sink not loaded
    Exit!


    I'm not sure if its related to sound.

    ReplyDelete
  2. Hey Im trying out your streamer, Ive been working on getting all the dependencys quieted. Ive run into one error I cant seem to get past.
    [rtmp @ 0x12db660] Server error: Authentication Failed.
    rtmp://live-fra.twitch.tv/app/: Input/output error

    any idea how to fix it?

    ReplyDelete
    Replies
    1. first: did you changed the key inside the file? did you deleted the string STREAM_KEY=$(cat twitch_key) ? from your error, it looks like you have changed it.

      Delete
    2. I had just changed (cat twitch_key) to my twitch key, I just deleted it and I still get the same error.


      Delete
    3. If it helps the whole line is

      Input #1, alsa, from 'pulse':
      Duration: N/A, start: 1386274307.704044, bitrate: N/A
      Stream #1.0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
      [rtmp @ 0xe34c20] Server error: Authentication Failed.
      rtmp://live-fra.twitch.tv/app/: Input/output error


      Delete
    4. You don't have to delete it ._.
      redownload the whole thing. open the "twitch_key" with an editor and delete the example key and paste yours taken from twitch.
      open the terminal and do:
      cd Twitch-Streamer-Linux
      chmod +x twitch.sh
      ./twitch.sh

      done.

      Delete
    5. Alright redownloaded and only changed the twitch_key file and not the cat twitch_key inside twitch.sh lol still getting the same thing.

      Delete
    6. On what kind of Linux OS are you?

      Delete
    7. I'm getting the same error. I am on Linux Mint 16 Petra.

      [rtmp @ 0x1cf9100] Server error: Authentication Failed.
      rtmp://live-dfw.twitch.tv/app/: Input/output error

      I followed your instructions exactly. Everything is installed. I'm still getting this error.

      Delete
    8. Fixed it. The name of my twitch_key file had a period in front of it. I just put .twitch_key in the code. However, the stream isn't exactly streaming. I launch it and it instantly stops. Here is the entire feed.

      sh twitch.sh
      Twitch Streamer for Linux
      Copyright (c) 2013, Giovanni Dante Grazioli (deroad)

      Click, with the mouse, on the Window that you want to Stream

      Please setup the Audio Output (something like 'pavucontrol')

      Webcam NOT found!! (/dev/video1)
      You should be online! Check on http://twitch.tv/ (Press CTRL+C to stop)
      avconv version 0.8.9-6:0.8.9-0ubuntu0.13.10.1, Copyright (c) 2000-2013 the Libav developers
      built on Nov 9 2013 19:09:46 with gcc 4.8.1
      [x11grab @ 0xf3efe0] device: :0.0+43,20 -> display: :0.0 x: 43 y: 20 width: 1280 height: 720
      [x11grab @ 0xf3efe0] shared memory extension found
      [x11grab @ 0xf3efe0] Estimating duration from bitrate, this may be inaccurate
      Input #0, x11grab, from ':0.0+43,20':
      Duration: N/A, start: 1386823534.241921, bitrate: 884736 kb/s
      Stream #0.0: Video: rawvideo, bgra, 1280x720, 884736 kb/s, 30 tbr, 1000k tbn, 30 tbc
      [alsa @ 0xf4aae0] capture with some ALSA plugins, especially dsnoop, may hang.
      [alsa @ 0xf4aae0] Estimating duration from bitrate, this may be inaccurate
      Input #1, alsa, from 'pulse':
      Duration: N/A, start: 1386823534.263549, bitrate: N/A
      Stream #1.0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
      Incompatible pixel format 'bgra' for codec 'libx264', auto-selecting format 'yuv420p'
      [buffer @ 0xefde20] w:1280 h:720 pixfmt:bgra
      [avsink @ 0xefdae0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
      [scale @ 0xf4d280] w:1280 h:720 fmt:bgra -> w:1280 h:720 fmt:yuv420p flags:0x4
      Segmentation fault

      Stopping Audio (Don't worry if you see errors here)
      Exit!

      Delete
    9. Im running Ubuntu 13.10 using MATE

      Delete
    10. @Ellipisis it Seg faults so i can say that is a avconv bug. this weekend i should update the script with some bugfixies

      Delete
    11. For Both of you, please use the FFMPEG version if you still have that problem.

      Delete
    12. Well I see you are dealing with some of the problems.. When I open it up to select the window it just closes right away.. I cant tell if its the same problem at all. Well I am looking forward to seeing if this all works. If this had a simple ui to plug in rather then text edit it be easier to see where its being plunged in wrong[if its just a text problem]. Wonder if there is a way to mod x- split easily in to linux but I doubt there is any good way to do that.

      Delete
    13. run from the terminal. do not doubleclick it. in that way you can see what's wrong.

      Delete
  3. Hi,

    I've been using my own avconv script to stream since a couple of months ago, I stopped streaming for a while and now my script does not work anymore, to be more specificaly, there is no error, just black/grey screen on justin/twitch side and after few seconds of "loading video" it just say I'm offline.
    So I tried your script but with the same exact result, did they change something in the video codec on justin/twitch.tv?

    Thank you.

    ReplyDelete
    Replies
    1. It's twitch. it does it with all softwares (also with the official ones, like OBS). they introduced a new system on their server and some stuff doesn't work, but i can tell you that your script works, if the stream is saved.

      Delete
  4. Hey, I get this when I click the window I want to stream:

    Please set up the Audio Output (something like 'pavucontrol')
    Failure: Module initialization failed

    Webcam NOT found!! (/dev/video1)
    You should be online! Check on http://twitch.tv/ (Press CTRL + C to stop)
    ./twitch.sh: line 85: avconc: command not found

    Stopping Audio (Don't worry if you see errors here)
    Failure: no such entity
    Failure: no such entity
    Failure: no such entity
    Exit!


    When I go to my twitch page it just shows grey. Please help :)

    ReplyDelete