1 | # Bash initialization for interactive non-login shells and
|
---|
2 | # for remote shells (info "(bash) Bash Startup Files").
|
---|
3 |
|
---|
4 | # Export 'SHELL' to child processes. Programs such as 'screen'
|
---|
5 | # honor it and otherwise use /bin/sh.
|
---|
6 | export SHELL
|
---|
7 |
|
---|
8 | if [[ $- != *i* ]]
|
---|
9 | then
|
---|
10 | # We are being invoked from a non-interactive shell. If this
|
---|
11 | # is an SSH session (as in "ssh host command"), source
|
---|
12 | # /etc/profile so we get PATH and other essential variables.
|
---|
13 | [[ -n "$SSH_CLIENT" ]] && source /etc/profile
|
---|
14 |
|
---|
15 | # Don't do anything else.
|
---|
16 | return
|
---|
17 | fi
|
---|
18 |
|
---|
19 | # Source the system-wide file.
|
---|
20 | source /etc/bashrc
|
---|
21 |
|
---|
22 | # Adjust the prompt depending on whether we're in 'guix environment'.
|
---|
23 | if [ -n "$GUIX_ENVIRONMENT" ]
|
---|
24 | then
|
---|
25 | PS1='\u@\h \w [env]\$ '
|
---|
26 | else
|
---|
27 | PS1='\u \w\$ '
|
---|
28 | fi
|
---|
29 |
|
---|
30 | # Colored ls
|
---|
31 | export LS_OPTIONS='--color=auto'
|
---|
32 | eval "`dircolors`"
|
---|
33 | alias ls='ls $LS_OPTIONS'
|
---|
34 |
|
---|
35 | # Autocomplete bash
|
---|
36 | complete -cf sudo
|
---|
37 | set -o history
|
---|
38 | set -o notify
|
---|
39 | shopt -q -s cdspell
|
---|
40 | shopt -s autocd
|
---|
41 |
|
---|
42 | streaming() {
|
---|
43 | INRES="1280x720" # input resolution
|
---|
44 | OUTRES="1280x720" # output resolution
|
---|
45 | FPS="10" # target FPS
|
---|
46 | GOP="20" # i-frame interval, should be double of FPS,
|
---|
47 | GOPMIN="10" # min i-frame interval, should be equal to fps,
|
---|
48 | THREADS="2" # max 6
|
---|
49 | CBR="1000k" # constant bitrate (should be between 1000k - 3000k)
|
---|
50 | QUALITY="ultrafast" # one of the many FFMPEG preset
|
---|
51 | AUDIO_RATE="44100"
|
---|
52 | STREAM_KEY="$1" # use the terminal command Streaming streamkeyhere to stream your video to twitch or justin
|
---|
53 | SERVER="live-sjc" # twitch server in California, see http://bashtech.net/twitch/ingest.php to change
|
---|
54 |
|
---|
55 | ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0 -f flv -ac 2 -ar $AUDIO_RATE \
|
---|
56 | -vcodec libx264 -g $GOP -keyint_min $GOPMIN -b:v $CBR -minrate $CBR -maxrate $CBR -pix_fmt yuv420p\
|
---|
57 | -s $OUTRES -preset $QUALITY -tune film -acodec libmp3lame -threads $THREADS -strict normal \
|
---|
58 | -bufsize $CBR "rtmp://$SERVER.twitch.tv/app/$STREAM_KEY"
|
---|
59 | }
|
---|