summaryrefslogtreecommitdiff
path: root/dot/local/bin/selfstream
diff options
context:
space:
mode:
Diffstat (limited to 'dot/local/bin/selfstream')
-rwxr-xr-xdot/local/bin/selfstream49
1 files changed, 49 insertions, 0 deletions
diff --git a/dot/local/bin/selfstream b/dot/local/bin/selfstream
new file mode 100755
index 0000000..85b8a8f
--- /dev/null
+++ b/dot/local/bin/selfstream
@@ -0,0 +1,49 @@
1#!/bin/bash
2
3AUDIO_DEVICE=pulse
4VIDEO_DEVICE=/dev/video0
5
6case $(hostname) in
7 fifty) outhost=blackbird ;;
8 blackbird) outhost=fifty; AUDIO_DEVICE=alsa ;;
9 *) outhost=$1
10esac
11
12MAX_RECORDING_TIME=00:05:00
13
14# https://trac.ffmpeg.org/wiki/StreamingGuide#Pointtopointstreaming
15
16VIDEO_OPTS='-framerate 30 -video_size 640x480'
17VIDEO_OPTS='-framerate 30 -video_size 320x240'
18# VIDEO_OPTS='-input_format mjpeg -framerate 30 -video_size 800x600'
19
20record()
21{
22 local timeout="${MAX_RECORDING_TIME+-t $MAX_RECORDING_TIME}"
23 ffmpeg -hide_banner -loglevel error -stats \
24 $timeout -f video4linux2 ${VIDEO_OPTS} -i "$VIDEO_DEVICE" \
25 $timeout -f "$AUDIO_DEVICE" -i default \
26 -c:v rawvideo -pix_fmt yuv420p -f xv win \
27 -c:a mp3 \
28 -c:v libxvid \
29 -f mpegts \
30 "$1"
31}
32
33# ffmpeg -i input -f rtsp -rtsp_transport tcp rtsp://localhost:8888/live.sdp
34# ffplay -rtsp_flags listen rtsp://localhost:8888/live.sdp?tcp
35
36#OUTPUT=${1:-udp://blackbird:55555}
37#INPUT=${2:-ffmpeg://udp://localhost:55555?listen}
38
39
40OUTPUT=udp://blackbird:55555
41
42silently() { "$@" >/dev/null 2>&1; }
43
44silently amixer-enable-mic
45banish
46
47record "$OUTPUT"
48# mpv "$INPUT"
49