Last Updated: February 25, 2016
·
1.994K
· darktim

Save rtmp streams as mp3

Let's think, you want to take some streams in rtmp format (like some episodes of "Maloney" on DRS3 ;) and put it on CD for a long ride by car...

#!/bin/bash
URL="${1}"
FILEmp3="${URL##*\/}"
FILEwav="${FILEmp3%%.*}.wav"
WDIR="$(mktemp -d "/tmp/rtpdump.XXXXXX")"
trap 'rm -rf "${WDIR}"' EXIT INT HUP
rtmpdump -r ${URL} -o ${WDIR}/${FILEmp3}
mplayer ${WDIR}/${FILEmp3} -ao pcm:file=${FILEwav}

Put this tiny script in ~/bin (if this is in your $PATH) and run it. First and only argument is the URL to the desired rtmp stream.

This script needs rtmpdump and mplayer installed on your system!