|
|
So you want to stream like the pro's do BUT you are a linux what todo?
Well windows users can do: LibrtiORDeth guide but the thing is this requires
#1 Flash Media Encoder RUNNING
#2 VH Screen Capture driver INSTALLED
#3 HoN (or some other app you plan to stream from your desktop)
(or via Xplit)
Problem with this is FME and the capture driver are windows-ONLY and there is no interest to provide such applications for linux.
So how to stream in linux. The requirements are actually quite simple
#1 Some means to capture the desktop
#2 Some means to capture sound (if interested)
#3 Some means to export via RTMP
VideoLAN (VLC) can capture the desktop and export via RTMP. It can also work in junction with JustinTV's commandline application.
Problem is so far no way to capture sound for linux (the option exists for windows)
WebcamStudio is a JAVA application that has a virtual webcam driver (will capture the desktop), it can then be used via streaming sites that connect to a webcam (JTV,Ustream) or can do FME broadcasting (as accepted by: Bambuser, Justin.tv, Feedocast)
There are however a few problems
#1 JAVA-based, can be quite CPU intensive and laggy
#2 the kernel module that is required for vloopback is ONLY for kernel-2.6.28, some hacking has managed to allow this to run on newer kernels but not the latest
#3 no sound
So how todo it?
FFFMPEG is a very powerful tool which follows the traditional *NIX philosophy of do one thing and do it well. FFMPEG job is to re-encode media and it does it very well
It can take different formats in and output in different formats.
So how todo it?
Code:streaming() { INRES="1920x1080" # input resolution OUTRES="640x360" FPS="15" # target FPS QUAL="fast" # one of the many FFMPEG preset STREAM_KEY="$1" URL="rtmp://live.justin.tv/app/$STREAM_KEY" #flashver=FMLE/3.0\20(compatible;\20FMSc/1.0)" #ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0 -ab 22050\ # -f alsa -ac 2 -i pulse -vcodec libx264 -s "$OUTRES" -level 30 -f mpegts \ # -acodec libmp3lame -ac 1 \ # -f flv "$URL" ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0 -ab 96k \ -f alsa -ac 2 -i pulse -vcodec libx264 -crf 30 -preset "$QUAL" -s "1280x720" \ -acodec libmp3lame -ar 44100 -threads 0 \ -f flv "$URL" }
With this placed into your ~/.bashrc (or saved as a script file) a convenient console command streaming will be available and can be launched:
$ streaming live_xxxxxxxxxxxxxxxxxxxxxxxxxx
There are a few variables that the user can set
INRES set to the desktop resolution
OUTRES sets the target resolution
FPS sets the desired FPS
QUAL sets FFMPEG preset configs for the x264 video encoder, including:
baseline
ipod320
ipod640
fast
max
medium
slow
slower
ultrafast
This option will determine the quality of the stream,how much bandwidth is needed (higher quality == more bandwidth), how much processing power is needed
Once set the bash function can be launched:
$ stream live_xxxxxxxxxxxxxxxxxxxxxxxxxx
where live_xxxxxxxxxxxxxxxxxxxxxxxxxx is the justin.tv live stream key (renews every day) obtainable from your login page.
Once you are up and streaming the sound associated with your stream will more than likely be just your mic. This is where PulseAudio comes in.
For all its problems (and it had alot when it 1st came out) it is very good these days. It will combine the Audio-IN and Audio-OUT feeds together
You will need to launch: pavucontrol
One word of warning when it comes to streaming.
WHATEVER you see on your monitor is what is broadcasted into the ether for anyone watching to see.
If you have anywhere on the screen, be it from your Justin.TV page, the commandline, EVEN the executing script the JTV key live_xxxxxxxxxxxxxxx is visible people can,do,will and have use it to hijack your stream, stream pr0n or anything else and get your JTV account locked
Last edited by Naib; 01-15-2012 at 05:43 PM.
Forum Moderators are not S2 Games employees. My posts in no way represent the view of S2 Games or any of its staff.
Please use the report post functionto have me review a post that you believe is breaking the Forum Rules.
Check the Sticky Threads for additional information on this sub-forum and the Announcement Threads for more information about Heroes of Newerth as a whole!
-----------------------------
Wow, was just roaming around the HoN forums and found this. That's what I searched for long time ago.
I've installed FFmpeg and created my JTV account. Edited my .bashrc and rebooted my comp.
The streaming command seems to work fine but I have a lil problem.
What's the problem? Where to enter my login information? I used the correct live_xxx key from my account. (that's at least what I think)Code:dominik@Dome-desktop:~$ streaming live_xxx FFmpeg version 0.6-4:0.6-2ubuntu6, Copyright (c) 2000-2010 the FFmpeg developers built on Oct 5 2010 22:36:53 with gcc 4.4.5 configuration: --extra-version=4:0.6-2ubuntu6 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-x11grab --enable-libdc1394 --enable-shared --disable-static WARNING: library configuration mismatch libavutil configuration: --extra-version=4:0.6-2ubuntu3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libmp3lame --enable-gpl --enable-postproc --enable-x11grab --enable-libfaad --enable-libxvid --enable-libx264 --enable-librtmp --enable-libdc1394 --enable-shared --disable-static libavcodec configuration: --extra-version=4:0.6-2ubuntu3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libmp3lame --enable-gpl --enable-postproc --enable-x11grab --enable-libfaad --enable-libxvid --enable-libx264 --enable-librtmp --enable-libdc1394 --enable-shared --disable-static libavutil 50.15. 1 / 50.15. 1 libavcodec 52.72. 2 / 52.72. 2 libavformat 52.64. 2 / 52.64. 2 libavdevice 52. 2. 0 / 52. 2. 0 libavfilter 1.19. 0 / 1.19. 0 libswscale 0.11. 0 / 0.11. 0 libpostproc 51. 2. 0 / 51. 2. 0 [x11grab @ 0x140e640]device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1680 height: 1050 [x11grab @ 0x140e640]shared memory extension found [x11grab @ 0x140e640]Estimating duration from bitrate, this may be inaccurate Input #0, x11grab, from ':0.0': Duration: N/A, start: 1299410741.644296, bitrate: 1128960 kb/s Stream #0.0: Video: rawvideo, bgra, 1680x1050, 1128960 kb/s, 20 tbr, 1000k tbn, 20 tbc [alsa @ 0x141c750]capture with some ALSA plugins, especially dsnoop, may hang. [alsa @ 0x141c750]Estimating duration from bitrate, this may be inaccurate Input #1, alsa, from 'pulse': Duration: N/A, start: 1299410741.714225, bitrate: N/A Stream #1.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s Server error: Authentication Failed. rtmp://live.justin.tv/app/ flashver=FMLE/3.0\20(compatible;\20FMSc/1.0): Input/output error
I downloaded that file: http://www.justin.tv/broadcast/fmle3_config (was logged in with my account information) and searched for the key. Got my key from that file.
Thank you Naib, for the great work; you put all informations together![]()
This looks like either network (ei the rtmp port blocked) or the wrong key.
I get my key from:
http://www.justin.tv/broadcast/adv_other
and clicking on the Stream Key: Show link & highlight, middleclick
Forum Moderators are not S2 Games employees. My posts in no way represent the view of S2 Games or any of its staff.
Please use the report post functionto have me review a post that you believe is breaking the Forum Rules.
Check the Sticky Threads for additional information on this sub-forum and the Announcement Threads for more information about Heroes of Newerth as a whole!
-----------------------------
Spotted the issue.
When I had that bash function on my HDD I had used different variables, when I went to paste here I decided to change the variables problem was I didn't change all occurances
re-read 1st post and re-copy the function
Forum Moderators are not S2 Games employees. My posts in no way represent the view of S2 Games or any of its staff.
Please use the report post functionto have me review a post that you believe is breaking the Forum Rules.
Check the Sticky Threads for additional information on this sub-forum and the Announcement Threads for more information about Heroes of Newerth as a whole!
-----------------------------
Hm, don't know whats wrong. The key is correct and I also forwarded the default RTMP port 1935 to my local address. (isn't needed but anyways)
I don't use a firewall or sth. similar. For example incoming SSH connections also work. But this is a outgoing connection. Shouldn't get any problems here...
I used to stream via xFire under winOS. Nothing I should compare with I know. But I have no clue why it's not working.
Forum Moderators are not S2 Games employees. My posts in no way represent the view of S2 Games or any of its staff.
Please use the report post functionto have me review a post that you believe is breaking the Forum Rules.
Check the Sticky Threads for additional information on this sub-forum and the Announcement Threads for more information about Heroes of Newerth as a whole!
-----------------------------
I have to admit it's maybe my problem.
Change the code to:
Same error:Code:streaming() { INRES="1680x1050" # input resolution OUTRES="1024x576" FPS="20" # target FPS QUAL="fast" # one of the many FFMPEG preset STREAM_KEY="$1" ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0 \ -f alsa -ac 2 -i pulse -vcodec libx264 -vpre "$QUAL" -s "$OUTRES" \ -acodec libmp3lame -ab 128k -threads 0 \ -f flv "rtmp://live.justin.tv/app/$STREAM_KEY flashver=FMLE/3.0\20(compatible;\20FMSc/1.0)" }
Code:dominik@Dome-desktop:~$ streaming live_xxx FFmpeg version 0.6-4:0.6-2ubuntu6, Copyright (c) 2000-2010 the FFmpeg developers built on Oct 5 2010 22:36:53 with gcc 4.4.5 configuration: --extra-version=4:0.6-2ubuntu6 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-gpl --enable-postproc --enable-x11grab --enable-libdc1394 --enable-shared --disable-static WARNING: library configuration mismatch libavutil configuration: --extra-version=4:0.6-2ubuntu3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libmp3lame --enable-gpl --enable-postproc --enable-x11grab --enable-libfaad --enable-libxvid --enable-libx264 --enable-librtmp --enable-libdc1394 --enable-shared --disable-static libavcodec configuration: --extra-version=4:0.6-2ubuntu3 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-vaapi --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libmp3lame --enable-gpl --enable-postproc --enable-x11grab --enable-libfaad --enable-libxvid --enable-libx264 --enable-librtmp --enable-libdc1394 --enable-shared --disable-static libavutil 50.15. 1 / 50.15. 1 libavcodec 52.72. 2 / 52.72. 2 libavformat 52.64. 2 / 52.64. 2 libavdevice 52. 2. 0 / 52. 2. 0 libavfilter 1.19. 0 / 1.19. 0 libswscale 0.11. 0 / 0.11. 0 libpostproc 51. 2. 0 / 51. 2. 0 [x11grab @ 0x1f3e640]device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1680 height: 1050 [x11grab @ 0x1f3e640]shared memory extension found [x11grab @ 0x1f3e640]Estimating duration from bitrate, this may be inaccurate Input #0, x11grab, from ':0.0': Duration: N/A, start: 1299495763.390100, bitrate: 1128960 kb/s Stream #0.0: Video: rawvideo, bgra, 1680x1050, 1128960 kb/s, 20 tbr, 1000k tbn, 20 tbc [alsa @ 0x1f4c750]capture with some ALSA plugins, especially dsnoop, may hang. [alsa @ 0x1f4c750]Estimating duration from bitrate, this may be inaccurate Input #1, alsa, from 'pulse': Duration: N/A, start: 1299495763.461662, bitrate: N/A Stream #1.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s Server error: Authentication Failed. rtmp://live.justin.tv/app/live_xxx flashver=FMLE/3.0\20(compatible;\20FMSc/1.0): Input/output error
I can try later sure (like in 8h) work atm so I can't try it here
Forum Moderators are not S2 Games employees. My posts in no way represent the view of S2 Games or any of its staff.
Please use the report post functionto have me review a post that you believe is breaking the Forum Rules.
Check the Sticky Threads for additional information on this sub-forum and the Announcement Threads for more information about Heroes of Newerth as a whole!
-----------------------------
I don't think the problem is the login/key cause when I change the key I get the exact same error. And I know it's correct.
I think more about "Input/output error" in the last line now.
I also recompiled "ffmpeg" and "x264" new and reinstalled them. Didn't change anything.
When I change the input res to for example 1680x1051 the script doesn't work completely, I get a different error message.
I also tried some different output res.
Is that normal btw?:
Server blocking me?Code:PING live.justin.tv (199.9.249.11) 56(84) bytes of data. From washington-city-paper.demarc.cogentco.com (38.104.56.22) icmp_seq=3 Packet filtered From washington-city-paper.demarc.cogentco.com (38.104.56.22) icmp_seq=4 Packet filtered . . .
Just listing some things I've tried.Code:dominik@Dome-desktop:~/Desktop$ ping google.de PING google.de (74.125.230.84) 56(84) bytes of data. 64 bytes from 74.125.230.84: icmp_req=1 ttl=54 time=23.6 ms 64 bytes from 74.125.230.84: icmp_req=2 ttl=54 time=22.6 ms
Crosslink: Created a thread in the JTV forums: http://community.justin.tv/forums/sh...ad.php?p=30713
ok I tried the key you sent in the PM
So the key and script seems valid. What isn't then is you contacting jtv.Code:[alsa @ 0x64eec0] capture with some ALSA plugins, especially dsnoop, may hang. [alsa @ 0x64eec0] Estimating duration from bitrate, this may be inaccurate Input #1, alsa, from 'pulse': Duration: N/A, start: 1299526006.804731, bitrate: N/A Stream #1.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s [buffer @ 0x697ac0] w:1280 h:1024 pixfmt:bgra [scale @ 0x6b5530] w:1280 h:1024 fmt:bgra -> w:640 h:512 fmt:yuv420p flags:0xa0000004 [libx264 @ 0x6757b0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 [libx264 @ 0x6757b0] profile High, level 2.2 [libx264 @ 0x6757b0] 264 - core 114 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 sliced_threads=0 nr=0 decimate=1 interlaced=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=30 rc=abr mbtree=1 bitrate=200 ratetol=1.0 qcomp=0.60 qpmin=10 qpmax=51 qpstep=4 ip_ratio=1.41 aq=1:1.00 Output #0, flv, to 'rtmp://live.justin.tv/app/live_xxxxxxxxxxxxx flashver=FMLE/3.0\20(compatible;\20FMSc/1.0)': Metadata: encoder : Lavf52.84.0 Stream #0.0: Video: libx264, yuv420p, 640x512, q=10-51, 200 kb/s, 1k tbn, 15 tbc Stream #0.1: Audio: libmp3lame, 44100 Hz, 2 channels, s16, 128 kb/s Stream mapping: Stream #0.0 -> #0.0 Stream #1.0 -> #0.1 Press [q] to stop encoding frame= 78 fps= 13 q=-1.0 Lsize= 170kB time=3.74 bitrate= 373.1kbits/s dup=0 drop=14 op=10 video:108kB audio:58kB global headers:0kB muxing overhead 2.487676% frame I:1 Avg QP:28.18 size: 32406 CTRL-c
You could try ustream they accept streaming via rtmp in a very similar way and the modifications requirerd would be minimal
Forum Moderators are not S2 Games employees. My posts in no way represent the view of S2 Games or any of its staff.
Please use the report post functionto have me review a post that you believe is breaking the Forum Rules.
Check the Sticky Threads for additional information on this sub-forum and the Announcement Threads for more information about Heroes of Newerth as a whole!
-----------------------------
Login to ustream
Click your name at the top (to enter your account settings)
Click on "Manage Your Show" (spanner icon)
Click on "Settings" (in the expanded menu)
Advanced settings (at the bottom)
There should be an option to download the xml for FME
Edit this file and there should be two parts, a URL and a key
Then you need a slightly modified script:Code:<url>rtmp://1.7356661.fme.ustream.tv/ustreamVideo/######</url> <backup_url></backup_url> <stream>Axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</stream>
Code:streaming() { INRES="1280x1024" # input resolution OUTRES="640x512" FPS="15" # target FPS QUAL="fast" # one of the many FFMPEG preset URL="rtmp://1.7356661.fme.ustream.tv/ustreamVideo/#######/xxxxxxxxxxxxxxxxxxxxxxxxxxxxx flashver=FMLE/3.0\20(compatible;\20FMSc/1.0)" ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0 \ -f alsa -ac 2 -i pulse -vcodec libx264 -vpre "$QUAL" -s "$OUTRES" \ -acodec libmp3lame -ab 128k -threads 0 \ -f flv "$URL" }
Ill tidy this up so it is a bit easier to work with w.r.t. jtv and ustream later, prob working from the fme file directly
Forum Moderators are not S2 Games employees. My posts in no way represent the view of S2 Games or any of its staff.
Please use the report post functionto have me review a post that you believe is breaking the Forum Rules.
Check the Sticky Threads for additional information on this sub-forum and the Announcement Threads for more information about Heroes of Newerth as a whole!
-----------------------------
Great! You are one of the best moderators I've seen so far.
Good and fast answers.
But switching to ustream did not work out.
Code:dominik@Dome-desktop:~$ streaming FFmpeg version git-f4f4e12, Copyright (c) 2000-2011 the FFmpeg developers built on Mar 7 2011 13:13:40 with gcc 4.4.5 configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab libavutil 50. 39. 0 / 50. 39. 0 libavcodec 52.113. 2 / 52.113. 2 libavformat 52.102. 0 / 52.102. 0 libavdevice 52. 2. 3 / 52. 2. 3 libavfilter 1. 76. 0 / 1. 76. 0 libswscale 0. 12. 0 / 0. 12. 0 libpostproc 51. 2. 0 / 51. 2. 0 [x11grab @ 0x2b235f0] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1680 height: 1050 [x11grab @ 0x2b235f0] shared memory extension found [x11grab @ 0x2b235f0] Estimating duration from bitrate, this may be inaccurate Input #0, x11grab, from ':0.0': Duration: N/A, start: 1299536681.591751, bitrate: 1128960 kb/s Stream #0.0: Video: rawvideo, bgra, 1680x1050, 1128960 kb/s, 20 tbr, 1000k tbn, 20 tbc [alsa @ 0x2b30fa0] capture with some ALSA plugins, especially dsnoop, may hang. [alsa @ 0x2b30fa0] Estimating duration from bitrate, this may be inaccurate Input #1, alsa, from 'pulse': Duration: N/A, start: 1299536681.701295, bitrate: N/A Stream #1.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s rtmp://1.6216020.fme.ustream.tv/ustreamVideo/xxxxxxx/xxxxxxxxxxxxx flashver=FMLE/3.0\20(compatible;\20FMSc/1.0): Input/output errorI'll just give it up...Code:streaming() { INRES="1680x1050" # input resolution OUTRES="1280x800" FPS="20" # target FPS QUAL="fast" # one of the many FFMPEG preset URL="rtmp://1.6216020.fme.ustream.tv/ustreamVideo/xxxxxxx/xxxxxxxxxx flashver=FMLE/3.0\20(compatible;\20FMSc/1.0)" ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0 \ -f alsa -ac 2 -i pulse -vcodec libx264 -vpre "$QUAL" -s "$OUTRES" \ -acodec libmp3lame -ab 128k -threads 0 \ -f flv "$URL" }
Can't figure out whats failing.
Ty anyways!
What distro? is it a source-based distro?
Forum Moderators are not S2 Games employees. My posts in no way represent the view of S2 Games or any of its staff.
Please use the report post functionto have me review a post that you believe is breaking the Forum Rules.
Check the Sticky Threads for additional information on this sub-forum and the Announcement Threads for more information about Heroes of Newerth as a whole!
-----------------------------