Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am using the latest updated Ubuntu 12.04 and I would like to know how I can stream my second monitor to an RTMP address. (Twitch.tv)

Is there any kind of streaming on Linux I can set up, or an up to date guide that shows how to do it in 12.04?

share|improve this question

3 Answers 3

Red5 Install red5-server

This is a free RTMP server for recording and streaming to a Flash client. Its features according to the project's home page are:

  • Streaming Audio/Video (FLV and MP3)
  • Recording Client Streams (FLV only)
  • Shared Objects
  • Live Stream Publishing (live h264 supported now)
  • Remoting ( AMF0/ AMF3)

The application is mainly intended to setup your own RTMP server. We have no experience on how to set up sending a stream to a remote streaming server and if we are able to do this for Twitch.tv. Some documentation exists on the project's home page indicating that this can be done.

A (somehow quite nested) documentation can be found on the projects pages:

share|improve this answer
    
Thanks for this list. I am a complete Ubuntu Novice. Can you link to the documentation that explains how to stream to RTMP? I'm very overwhelmed with all these foreign commands / documentation. –  Michaeljwjr Jul 25 '12 at 20:42
    
How come there are two upvotes, but no explanation how to do this exactly? –  otakun85 Jul 8 at 16:47

A good google search finds a bit. Best to do that first. Anyhow its not easy but take a look at this: http://michaelchinen.com/2011/06/27/justin-tv-streaming-in-linux/

share|improve this answer
3  
Welcome to Ask Ubuntu! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  Eliah Kagan Jul 25 '12 at 8:13
    
Noted Eliah, Thanks! –  Vromoth Jul 25 '12 at 8:24
    
If you want to improve your answer, you can always edit it (the edit link is under the answer, near the left side). –  Eliah Kagan Jul 25 '12 at 8:31
    
That, like all of the other tutorials I've already found through google searches, are obsolete. –  Michaeljwjr Jul 25 '12 at 19:52

You can stream directly to an RMTP address using ffmpeg or avconv provided you have the necessary authentication (stream key).

An condensed example of using ffmpeg to stream to the Twitch.tv RMTP server would be as follows:

# stream key. You can set this manually.
STREAM_KEY=$(cat ~/.twitch_key)

# stream url. Note the formats for twitch.tv and justin.tv
# twitch:"rtmp://live.twitch.tv/app/$STREAM_KEY"
# justin:"rtmp://live.justin.tv/app/$STREAM_KEY"
STREAM_URL="rtmp://live.twitch.tv/app/$STREAM_KEY"

ffmpeg \
-f alsa -ac 2 -i "pulse" \
-f x11grab -s $(xwininfo -root | awk '/geometry/ {print $2}'i) -r "30" -i :0.0 \
-vcodec libx264 -pix_fmt yuv420p -s "640x360" -vpre "fast" \
-acodec libmp3lame -threads 6 -qscale 5 -b 64KB \
-f flv -ar 22050 "$STREAM_URL"

For more information on how to stream to popular platforms like twitch.tv and justin.tv see this askubuntu answer.

A gist of an extended version of the above script can be found here: https://gist.github.com/oseparovic/2db2aaa737cd37e7c068

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.