3 while getopts "p:s:" opt
; do
4 echo "$opt" >> /tmp
/someopts
5 echo "$OPTARG" >> /tmp
/someopts
14 echo "Invalid option: -$OPTARG" >&2
18 echo "Option -$OPTARG requires an argument." >&2
23 key_re
="([a-zA-Z0-9_]+?)[[:space:]]*="
24 value_re
="=[[:space:]]*(.+?)"
26 while IFS
='' read -r line ||
[[ -n
$line ]]; do
27 [[ "$line" =~
$key_re ]] && key
=${BASH_REMATCH[1]}
28 [[ "$line" =~
$value_re ]] && value
=${BASH_REMATCH[1]}
30 if [[ ! -z
"$key" ]] && [[ ! "${key}xxx" = "xxx" ]] && [[ ! -z
"$value" ]] && [[ ! "${value}xxx" = "xxx" ]]; then
33 done < "/itg/PreCom/stream_parameters.txt"
35 dos2unix
/mnt
/shares
/itg-repo
/CaptureInfo.txt
> /dev
/null
2>&1
37 line1
=$
(sed -n
"1p" "/mnt/shares/itg-repo/CaptureInfo.txt")
38 line2
=$
(sed -n
"2p" "/mnt/shares/itg-repo/CaptureInfo.txt")
41 IFS
=', ' read -a v1coords
<<< "$line1"
42 IFS
=', ' read -a v2coords
<<< "$line2"
45 /usr
/local/bin
/ffmpeg
-y
-f x11grab
-r
"$framerate" -i
0:0 -f video4linux2
-i
/dev
/video0
-itsoffset
0.1 -f alsa
-i
"plughw:CARD=${device},DEV=0" -filter_complex \
46 "[0:v]setpts=PTS-STARTPTS+${video_offset}/TB,scale=$((v1coords[2])):$((v1coords[3])),pad=1280:720:$((v1coords[0])):$((v1coords[1])):black[v1];[1:v]setpts=PTS-STARTPTS,scale=$((v2coords[2])):$((v2coords[3]))[v2]; [v1][v2]overlay=$((v2coords[0])):$((v2coords[1]))" \
47 -f flv
-vcodec libx264
-g
"$framerate" -keyint_min
"$framerate" -b
"$video_bitrate" -minrate
"$video_bitrate" -maxrate
"$video_bitrate" -pix_fmt yuv420p
-preset ultrafast
-tune film
-threads
2 -s
1280:720 \
48 -strict experimental
-bufsize
"$video_bitrate" -ar "$audio_bitrate" /itg
/stream.mp4
> /dev
/null
2>&1 &
50 #if [[ -z "$stream" ]]; then
53 # obs_profile="PeekingBoo-ITG"
54 # obs_scene="PeekingBoo"
57 # obs_profile="BirdyMint-ITG"
58 # obs_scene="PeekingBoo"
61 # obs_profile="DivinElegy-ITG"
62 # obs_scene="PeekingBoo"
65 if [[ -n
"$obs_profile" ]] && [[ -n
"$obs_scene" ]]; then
66 ssh PeekingBoo@
192.168.0.6 'C:\Program Files\PsExec.exe -i -s "C:\Program Files (x86)\OBS\OBS.exe"' -profile
"$obs_profile" \
67 -scenecollection
"$obs_scene" -start
> /dev
/null
2>&1 &
70 #XXX: Loop forever so start-stop-daemon can kill us