Bash Scripts: Unterschied zwischen den Versionen
Amir (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung |
Amir (Diskussion | Beiträge) |
||
Zeile 119: | Zeile 119: | ||
[ $CLEAN ] && clean | [ $CLEAN ] && clean | ||
</pre> | </pre> | ||
== gstrtpcast == | |||
Grab audio from a pulse monitor src and stream it via rtp. though pulseaudio is capable of streaming sound via rtp it is not able to compress the stream. additionally its not nearly as flexible as gstreamer. | |||
<pre> | |||
#!/bin/bash | |||
ENCODER=" vorbisenc ! rtpvorbispay "; | |||
DEVICE="/dev/video0" | |||
GST_OPTS= | |||
SET_SINK= | |||
CLIENTS= | |||
VERBOSE= | |||
TEMP=`getopt -o e:d:g:vs --long encoder:,device:,gst-opts:,verbose,set-default-sink \ | |||
-n 'gstrtpcast' -- "$@"` | |||
[ $? != 0 ] && exit 1 | |||
eval set -- "$TEMP" | |||
while true ; do | |||
case "$1" in | |||
-e|--encoder) ENCODER="$2" ; shift 2 ;; | |||
-d|--device) SRC_NAME="$2" ; shift 2 ;; | |||
-g|--gst-opts) GST_OPTS="$GST_OPTS $2" ; shift 2 ;; | |||
-v|--verbose) VERBOSE=0 ; shift ;; | |||
-s|--set-default-sink) SET_SINK=0; shift ;; | |||
--) shift ; break ;; | |||
*) echo "Internal error!" ; exit 1 ;; | |||
esac | |||
done | |||
for arg do CLIENTS="$arg"; break ; done | |||
[ -n $DEVICE ] && DEVICE=`pacmd list-sources | fgrep 'alsa_output.platform-snd_dummy' | awk -F '[<>]' '{ print $2 }'` | |||
[ $SET_SINK ] && pacmd "set-default-sink $[ `echo $SRC_NAME | awk -F '.' '{ print $3 }'` + 1 ]" 1> /dev/null; | |||
echo -e "---\n" | |||
echo "cast: $DEVICE"; | |||
echo "to: $CLIENTS"; | |||
echo "encoder: $ENCODER" | |||
echo -e "\n---\n" | |||
[ $VERBOSE ] && GST_OPTS="$GST_OPTS -v" echo "gst-launch $GST_OPT pulsesrc device=\"$DEVICE\" ! $ENCODER ! multiudpsink clients=\"$CLIENTS\"" | |||
gst-launch $GST_OPTS pulsesrc device="$DEVICE" ! $ENCODER ! multiudpsink clients="$CLIENTS"; | |||
</pre> | |||
[[Kategorie:CLI]] | [[Kategorie:CLI]] |