ref: ce7c66bff42a5073a334915fda1f70398747828c
dir: /bin/twitch/
#!/bin/rc rfork n fn usage{ echo usage: $0 '[-u sys] [-w]' >[1=2] exit usage } if(! test -f /tmp/t) usage echo hwgc soft >/dev/vgactl echo blanktime 0 >/dev/mousectl switch($sysname){ case hsw t490s x240 parm=(-f 60 -k 1000 -Q 50) case w520 parm=(-f 30 -Q 33) case * res=(-f 15 -Q 33) } pl=() h=() audio=/mnt/mix/audio scr=/dev/screen while(~ $1 -?){ switch($1){ case -u h=$2 rimport $h '#u' /n/c audio=/n/c/audioin shift 2 case -w echo resize -dx 1288 -dy 1032 >/dev/wctl pl=plumb.$pid unmount /mnt/plumb plumber -s $pl scr=/dev/wsys/^`{sed 's/ +//g' /mnt/wsys/winid} case * usage } } if(~ $#h 0) window -hide -m rc -c 'dd -bs 44100 -if /dev/zero -of /mnt/mix/audio' video/hj264 $parm $scr |\ video/rtmp -a <{audio/aacenc -B 262144 -b <$audio} \ `{cat /tmp/t} & if(! ~ $#pl 0) bof echo 'slay rtmp hj264 dd | rc' echo 'echo blanktime 5 >/dev/mousectl' if(! ~ $#pl 0) echo rm -f $pl