summaryrefslogtreecommitdiff
path: root/localmms2stdout
blob: e1bd3aaedd44047b76434cdc47d8868ae38c32e4 (plain)
  1. #!/bin/sh
  2. #
  3. # Copyright © 2013 Jonas Smedegaard <dr@jones.dk>
  4. # Description: Re-stream MMS stream to stdout
  5. #
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 3, or (at your option)
  9. # any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. # General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  19. # 02111-1307 USA.
  20. #
  21. # Depends: libav-tools
  22. set -e
  23. PRG=$(basename "$0")
  24. showhelp() {
  25. cat <<EOF
  26. Usage: $PRG STREAM
  27. Examples:
  28. $PRG bbc6
  29. $PRG mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/6music/6music_bb_live_ep1_sl0
  30. Use pseudo-protocol mmsh:// for mms-over-http.
  31. EOF
  32. }
  33. exit1() {
  34. echo "ERROR: $1"
  35. exit 1
  36. }
  37. url=
  38. # TODO: resolve http redirections, Like BBC6:
  39. # http://sradio.tv/stream/489.m3u → http://www.bbc.co.uk/6music/ram/6music.asx
  40. # TODO: Add more shortnames than BBC6
  41. case "$1" in
  42. mmst:*|mmsh*) url="$1";;
  43. bbc6) url=mms://wmlive-acl.bbc.co.uk/wms/bbc_ami/6music/6music_bb_live_ep1_sl0;;
  44. *) showhelp; exit1 "unknown or missing stream";;
  45. esac
  46. url=`echo "$url" | perl -pe 's/^mms:/mmst/'`
  47. avconv -i "$url" -c copy -f avi pipe:1
  48. # alternative methods (needs mms:// protocol URLs)
  49. #mimms -q "$url" -
  50. #gst-launch -q mmssrc "location=$url" '!' fdsink fd=1