Guest User

livestream.sh

a guest
Sep 18th, 2014
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Account Info
  2. CHANNEL="CHANNEL"
  3. user="USERNAME"
  4. passw="PASSWORD"
  5.  
  6. RECORD="false"                                              # Record stream
  7. APILOT="true"                                               # AutoPilot
  8.  
  9. #Aspect and Resolution
  10. W_RATIO=16
  11. H_RATIO=9
  12.  
  13. SOURCE="x11grab"
  14. VINPUT=":0.0"
  15.  
  16. #SOURCE="video4linux2"
  17. #VINPUT="/dev/video0"
  18.  
  19.  
  20. INRES="$(xwininfo -root | grep 'geometry' | awk '{print $2;}')"                                            # Input resolution
  21.  
  22. #OUTRES="hd480"                                             # Output resolution (480p)
  23. OUTRES="hd720"                                              # Output resolution (720p)
  24. #OUTRES="hd1080"                                            # Output resolution (native)
  25.  
  26. VIDBITRATE="385k"                                           # Video bitrate
  27.  
  28. THREADS="auto"                                              # Number of threads/cores available to each stream ("A V")
  29. FRAMESKIP="none"                                            # Possible values:
  30.                                                             #‘none’
  31.                                                             #‘default’
  32.                                                             #‘noref’
  33.                                                             #‘bidir’
  34.                                                             #‘nokey’
  35.                                                             #‘all’
  36.  
  37. ACHANNELS="2"                                               # Specify mono or stereo (1=mono|2=stereo)
  38. ABITRATE="44100"                                            # Audio bitrate (CD Quality)
  39. #ABITRATE="22050"                                           # Audio bitrate (Radio Quality)
  40. AOFFSET="0"                                                 #Audio offset. Defines how long a delay till the sound plays (in seconds)
  41.  
  42. FPS="24"                                                    # target FPS
  43. QUAL="ultrafast"                                            # one of the many FFMPEG presets on (k)ubuntu found in /usr/share/ffmpeg
  44.                                                             # If you have low bandwidth, put the qual preset on 'fast' (upload bandwidth)
  45.                                                             # If you have medium bandwitch put it on normal to medium
  46.  
  47. notify-send "LiveStream" "Stream started. Press 'Ctrl+C' to stop streaming. Recording: '$RECORD'" -i ~/.livestream/livestream-icon.png
  48.  
  49. avconv -f x11grab -framerate $FPS -show_region 1 -video_size $INRES -i :0.0+0,0 -f pulse -i default -r $FPS -s $OUTRES  -ar $ABITRATE -vb $VIDBITRATE -ab 128k -strict experimental -y -vcodec libx264 -bufsize 2000k -preset ultrafast -acodec mp3 -bufsize 2000k -g 48 -f flv "rtmp://publish.livestream.com/mogulus/$CHANNEL/username=$user/password=$passw/isAutoLive=true/autoVOD=true/autoRecord=$RECORD/autoPilot=$APILOT/aspectWidth=$W_RATIO/aspectHeight=$H_RATIO app=mogulus/$CHANNEL/username=$user/password=$passw/isAutoLive=true/autoVOD=true/autoRecord=$RECORD/autoPilot=$APILOT/aspectWidth=$W_RATIO/aspectHeight=$H_RATIO"
  50.  
  51. notify-send "LiveStream" "Stream stopped." -i ~/.livestream/livestream-icon.png
  52.  
  53. exit
  54.  
  55. ## Removed extra (apparently useless) streams.
  56. ## Complete overhaul of avconv options and variables. Script is buggy, but is at least somewhat functional again.
  57. ## Restored input FPS value, more cleanup, fixed input/output resolution.
  58. ## Lesser overhaul, almost there. Focusing on video claeity issues.
Add Comment
Please, Sign In to add comment