summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlocalmms2stdout61
1 files changed, 61 insertions, 0 deletions
diff --git a/localmms2stdout b/localmms2stdout
new file mode 100755
index 0000000..e1bd3aa
--- /dev/null
+++ b/localmms2stdout
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Copyright © 2013 Jonas Smedegaard <dr@jones.dk>
+# Description: Re-stream MMS stream to stdout
+#
+# This program 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 3, or (at your option)
+# any later version.
+#
+# This program 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 program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+# 02111-1307 USA.
+#
+# Depends: libav-tools
+
+set -e
+
+PRG=$(basename "$0")
+
+showhelp() {
+ cat <<EOF
+Usage: $PRG STREAM
+
+Examples:
+ $PRG bbc6
+ $PRG mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/6music/6music_bb_live_ep1_sl0
+
+Use pseudo-protocol mmsh:// for mms-over-http.
+
+EOF
+}
+
+exit1() {
+ echo "ERROR: $1"
+ exit 1
+}
+
+url=
+# TODO: resolve http redirections, Like BBC6:
+# http://sradio.tv/stream/489.m3u → http://www.bbc.co.uk/6music/ram/6music.asx
+# TODO: Add more shortnames than BBC6
+case "$1" in
+ mmst:*|mmsh*) url="$1";;
+ bbc6) url=mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/6music/6music_bb_live_ep1_sl0;;
+ *) showhelp; exit1 "unknown or missing stream";;
+esac
+
+url=`echo "$url" | perl -pe 's/^mms:/mmst/'`
+
+avconv -i "$url" -c copy -f avi pipe:1
+
+# alternative methods (needs mms:// protocol URLs)
+#mimms -q "$url" -
+#gst-launch -q mmssrc "location=$url" '!' fdsink fd=1