From f4bd641e36418bc2a43bc31d8ac0bf57b1c51953 Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Sun, 9 Dec 2018 03:58:58 -0500 Subject: new commands --- dot/local/bin/selfstream | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 dot/local/bin/selfstream (limited to 'dot/local/bin/selfstream') 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 @@ +#!/bin/bash + +AUDIO_DEVICE=pulse +VIDEO_DEVICE=/dev/video0 + +case $(hostname) in + fifty) outhost=blackbird ;; + blackbird) outhost=fifty; AUDIO_DEVICE=alsa ;; + *) outhost=$1 +esac + +MAX_RECORDING_TIME=00:05:00 + +# https://trac.ffmpeg.org/wiki/StreamingGuide#Pointtopointstreaming + +VIDEO_OPTS='-framerate 30 -video_size 640x480' +VIDEO_OPTS='-framerate 30 -video_size 320x240' +# VIDEO_OPTS='-input_format mjpeg -framerate 30 -video_size 800x600' + +record() +{ + local timeout="${MAX_RECORDING_TIME+-t $MAX_RECORDING_TIME}" + ffmpeg -hide_banner -loglevel error -stats \ + $timeout -f video4linux2 ${VIDEO_OPTS} -i "$VIDEO_DEVICE" \ + $timeout -f "$AUDIO_DEVICE" -i default \ + -c:v rawvideo -pix_fmt yuv420p -f xv win \ + -c:a mp3 \ + -c:v libxvid \ + -f mpegts \ + "$1" +} + +# ffmpeg -i input -f rtsp -rtsp_transport tcp rtsp://localhost:8888/live.sdp +# ffplay -rtsp_flags listen rtsp://localhost:8888/live.sdp?tcp + +#OUTPUT=${1:-udp://blackbird:55555} +#INPUT=${2:-ffmpeg://udp://localhost:55555?listen} + + +OUTPUT=udp://blackbird:55555 + +silently() { "$@" >/dev/null 2>&1; } + +silently amixer-enable-mic +banish + +record "$OUTPUT" +# mpv "$INPUT" + -- cgit v1.2.3