From b3b28a5faa5db4d8e5f0ae4f3facdc2813f04bbd Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Fri, 20 Jun 2008 19:33:43 +0000 Subject: [PATCH] Initial import. --- iptv/internetradio.sh | 67 +++++++++++++++++++++++++++++++++++++++++ iptv/linein.sh | 54 +++++++++++++++++++++++++++++++++ iptv/webcam.sh | 69 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 190 insertions(+) create mode 100755 iptv/internetradio.sh create mode 100755 iptv/linein.sh create mode 100755 iptv/webcam.sh diff --git a/iptv/internetradio.sh b/iptv/internetradio.sh new file mode 100755 index 0000000..5bb9219 --- /dev/null +++ b/iptv/internetradio.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +# internetradio.sh is used by the VDR iptv plugin to transcode an internet +# radio stream. +# +# The script originates from: +# http://www.vdr-wiki.de/wiki/index.php/Iptv-plugin +# +# An example channels.conf entry: +# internetradio;IPTV:2:IPTV|S0P0|EXT|internetradio.sh|0:P:0:0:256:0:0:2:0:0:0 +# +# internetradio.sh is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This package is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this package; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +# MA 02110-1301, USA. +# + +if [ $# -ne 2 ]; then + logger "$0: error: Invalid parameter count '$#' $*" + exit 1; +fi + +# Channels.conf parameter +PARAMETER=${1} + +# Iptv plugin listens this port +PORT=${2} + +# Stream configuration +URL="mms://stream" +TITLE="internetradio" + +# Stream temporary files +FIFO=/tmp/internetradio.fifo +LOG=/dev/null + +{ +rm -f "${FIFO}" +mkfifo "${FIFO}" + +mplayer -dumpstream "${URL}" \ + -quiet -nolirc -noautosub -noconsolecontrols -novideo -nojoystick \ + -dumpfile "$FIFO" & + +# Time to connect and fill pipe +sleep 3 + +# Build audio only stream +# PID 0x100/256 = Audio +ffmpeg -v -1 \ + -i "${FIFO}" \ + -title "${TITLE}" \ + -f mpegts -acodec mp2 -ac 2 -ab 96k -ar 48000 \ + - | nc -u 127.0.0.1 ${PORT} + +rm -f "${FIFO}" +} > ${LOG} 2>&1 diff --git a/iptv/linein.sh b/iptv/linein.sh new file mode 100755 index 0000000..c6944b5 --- /dev/null +++ b/iptv/linein.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +# linein.sh is used by the VDR iptv plugin to transcode line-in of +# a soundcard. +# +# The script originates from: +# http://www.vdr-wiki.de/wiki/index.php/Iptv-plugin +# +# An example channels.conf entry: +# linein;IPTV:5:IPTV|S0P0|EXT|linein.sh|0:P:27500:0:256:0:0:5:5:5:0 +# +# linein.sh is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This package is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this package; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +# MA 02110-1301, USA. +# + +if [ $# -ne 2 ]; then + logger "$0: error: Invalid parameter count '$#' $*" + exit 1; +fi + +# Channels.conf parameter +PARAMETER=${1} + +# Iptv plugin listens this port +PORT=${2} + +# Stream configuration +TITLE="linein" + +# Stream temporary files +LOG=/dev/null + +{ +# PID 0x100/256 = Audio +arecord -q -D hw:0,0 -f dat | \ +ffmpeg -v -1 \ + -f wav \ + -i - \ + -title "${TITLE}" \ + -f mpegts -acodec mp2 -ac 2 -ab 128k -ar 48000 \ + - | nc -nu 127.0.0.1 ${PORT} +} > ${LOG} 2>&1 diff --git a/iptv/webcam.sh b/iptv/webcam.sh new file mode 100755 index 0000000..c900b47 --- /dev/null +++ b/iptv/webcam.sh @@ -0,0 +1,69 @@ +#!/bin/sh + +# webcam.sh is used by the VDR iptv plugin to transcode an internet radio +# stream remuxed with images (e.g. webcam) to provide a video stream. +# +# The script originates from: +# http://www.vdr-wiki.de/wiki/index.php/Iptv-plugin +# +# An example channels.conf entry: +# webcam;IPTV:3:IPTV|S0P0|EXT|webcam.sh|0:P:0:256:257:0:0:3:0:0:0 +# +# webcam.sh is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This package is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this package; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +# MA 02110-1301, USA. +# + +if [ $# -ne 2 ]; then + logger "$0: error: Invalid parameter count '$#' $*" + exit 1; +fi + +# Channels.conf parameter +PARAMETER=${1} + +# Iptv plugin listens this port +PORT=${2} + +# Stream configuration +URL="http://stream.address" +IMAGE="image.jpg" +TITLE="webcam" + +# Stream temporary files +FIFO=/tmp/webcam.fifo +LOG=/dev/null + +{ +rm -f "${FIFO}" +mkfifo "${FIFO}" + +mplayer -dumpstream "${URL}" \ + -quiet -nolirc -noautosub -noconsolecontrols -novideo -nojoystick \ + -dumpfile "${FIFO}" & + +# Time to connect and fill pipe +sleep 3 + +# Build stream from audiodump with cycle image as video +# PID 0x100/256 = Video 0x101/257 = Audio +ffmpeg -v -1 \ + -i "${FIFO}" -r 0.5 -loop_input -i '${IMAGE}' \ + -title "${TITLE}" \ + -f mpegts -intra -r 24 -vcodec mpeg2video -b 500k -s 352x288 \ + -acodec mp2 -ac 2 -ab 96k -ar 48000 \ + - | nc -u 127.0.0.1 ${PORT} + +rm -f "${FIFO}" +} > ${LOG} 2>&1