diff options
Diffstat (limited to 'dot/local/bin/selfstream')
-rwxr-xr-x | dot/local/bin/selfstream | 49 |
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 | |||
3 | AUDIO_DEVICE=pulse | ||
4 | VIDEO_DEVICE=/dev/video0 | ||
5 | |||
6 | case $(hostname) in | ||
7 | fifty) outhost=blackbird ;; | ||
8 | blackbird) outhost=fifty; AUDIO_DEVICE=alsa ;; | ||
9 | *) outhost=$1 | ||
10 | esac | ||
11 | |||
12 | MAX_RECORDING_TIME=00:05:00 | ||
13 | |||
14 | # https://trac.ffmpeg.org/wiki/StreamingGuide#Pointtopointstreaming | ||
15 | |||
16 | VIDEO_OPTS='-framerate 30 -video_size 640x480' | ||
17 | VIDEO_OPTS='-framerate 30 -video_size 320x240' | ||
18 | # VIDEO_OPTS='-input_format mjpeg -framerate 30 -video_size 800x600' | ||
19 | |||
20 | record() | ||
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 | |||
40 | OUTPUT=udp://blackbird:55555 | ||
41 | |||
42 | silently() { "$@" >/dev/null 2>&1; } | ||
43 | |||
44 | silently amixer-enable-mic | ||
45 | banish | ||
46 | |||
47 | record "$OUTPUT" | ||
48 | # mpv "$INPUT" | ||
49 | |||