Advertisement
Guest User

Untitled

a guest
Dec 13th, 2012
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.23 KB | None | 0 0
  1. #justin.tv streaming command functionality
  2.  
  3. streaming() {
  4. INRES="800x800" # input resolution
  5. OUTRES="800x800" # Output resolution
  6. FPS="10" # target FPS
  7. QUAL="fast" # one of the many FFMPEG preset on (k)ubuntu found in /usr/share/ffmpeg
  8. # If you have low bandwidth, put the qual preset on 'fast' (upload bandwidth)
  9. # If you have medium bandwitch put it on normal to medium
  10. STREAM_KEY="live_mystreamkey_icantshareitsorry" # This is your streamkey generated by jtv/twitch found at: http://www.justin.tv/broadcast/adv_other
  11.  
  12. ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0+0,0 -itsoffset 00:00:01 -f alsa -ac 1 -i pulse -vcodec libx264 -pix_fmt yuv420p -vpre "$QUAL" -s "$OUTRES" -acodec libmp3lame -ab 96k -ar 44100 -threads 2 -qscale 5 -b 100000 -f flv "rtmp://live.justin.tv/app/$STREAM_KEY"
  13. }
  14.  
  15.  
  16. # -f x11grab = force format. This causes ffmpeg to force the format to grab the x11 display
  17.  
  18. # -s "$INRES" = Sets the frame size of the grab to the input resolution. This is Width X Height. The "$INRES" is a variable that you set previously.
  19.  
  20. # -r "$FPS" = this sets the framerate to your target fps. (it's okay if it doesn't hit this rate, but I wouldn't set it much higher than 35)
  21.  
  22. # -i :0.0+0,0 = -i usually refers to the input filename. Since we're grabbing the display, the :0.0+0,0 tells it the coordinates of the screen to grab and how much area of the screen to grab. Incidentally :0.0+0,0 tells it to grab the entire screen.
  23.  
  24. # -itsoffset 00:00:01 = This sets an input time offset in seconds "hh:mm:ss" only applies to input files that come after it. (this isn't neccesary, only attempts to correct for lag between audio and video.
  25.  
  26. # -f alsa = Forcing the alsa format
  27.  
  28. # -ac 2 = sets the adio channels to 2 (stereo). Defaults to 1 (mono).
  29.  
  30. # -i pulse = sets ffmpeg to capture audio from pulse
  31.  
  32. # -vcodec libx264 = forces ffmpeg to use the cideo codec of libx264
  33.  
  34. # -vpre "$QUAL" = forces ffmpeg to use the "$QUAL" (quality variable) presets.
  35.  
  36. # -s "$OUTRES" = sets the output size to the "$OUTRES" variable. I have played with this and found that for best quality it should probably match $INRES
  37.  
  38. # -acodec libmp3lame = forces ffmpeg to compress the audio into an mp3 stream
  39.  
  40. # -ab 96k = sets the audio bitrate to 96k - this doesn't have to be high on the stream and will help scale back the bandwidth usage.
  41.  
  42. # -threads 6 = Thread count. Typically this should only be as high as the number of processing cores you have available.
  43.  
  44. # -qscale 5 = This has to do with the compression of the overall thread (quantization) Leave it at 5.
  45.  
  46. # -f flv = forces the output format to flv (the flash video format that jtv/twitch can recognize)
  47.  
  48. # -b 1024kb = this is the bitrate of the output stream. YOU WILL NEED TO CHANGE THIS TO WORK WITH YOUR BANDWIDTH/ISP SETTINGS.
  49.  
  50. # "rtmp://live.justin.tv/app/$STREAM_KEY" = this is the output file, in our case it outputs it via the RTMP protocol to justin.tv using your streamkey.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement