source: dotfiles/guix/.bashrc@ f4d72e8

Last change on this file since f4d72e8 was f4d72e8, checked in by Mikhail Kirillov <w96k@…>, on Oct 25, 2019 at 2:33:40 AM

Add streaming function in bashrc

  • Property mode set to 100644
File size: 1.8 KB
Line 
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.
6export SHELL
7
8if [[ $- != *i* ]]
9then
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
17fi
18
19# Source the system-wide file.
20source /etc/bashrc
21
22# Adjust the prompt depending on whether we're in 'guix environment'.
23if [ -n "$GUIX_ENVIRONMENT" ]
24then
25 PS1='\u@\h \w [env]\$ '
26else
27 PS1='\u@\h \w\$ '
28fi
29alias ls='ls -p --color=auto'
30alias ll='ls -l'
31alias grep='grep --color=auto'
32
33streaming() {
34 INRES="1280x720" # input resolution
35 OUTRES="1280x720" # output resolution
36 FPS="10" # target FPS
37 GOP="20" # i-frame interval, should be double of FPS,
38 GOPMIN="10" # min i-frame interval, should be equal to fps,
39 THREADS="2" # max 6
40 CBR="1000k" # constant bitrate (should be between 1000k - 3000k)
41 QUALITY="ultrafast" # one of the many FFMPEG preset
42 AUDIO_RATE="44100"
43 STREAM_KEY="$1" # use the terminal command Streaming streamkeyhere to stream your video to twitch or justin
44 SERVER="live-sjc" # twitch server in California, see http://bashtech.net/twitch/ingest.php to change
45
46 ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0 -f flv -ac 2 -ar $AUDIO_RATE \
47 -vcodec libx264 -g $GOP -keyint_min $GOPMIN -b:v $CBR -minrate $CBR -maxrate $CBR -pix_fmt yuv420p\
48 -s $OUTRES -preset $QUALITY -tune film -acodec libmp3lame -threads $THREADS -strict normal \
49 -bufsize $CBR "rtmp://$SERVER.twitch.tv/app/$STREAM_KEY"
50}
Note: See TracBrowser for help on using the repository browser.