DavidDecotigny

Ra2Ogg

Navigation

  • Rechercher un mot :

Realaudio vers Ogg


Pour récupérer le flux realaudio décompressé, il y a (au moins) libreplay et vsound. Pour une raison que j'ai oubliée, j'utilise libreplay...

Voici un script qui utilise libreplay 0.4 (peut-être pas encore officiellement disponible) pour transformer tout ça en 1 seul fichier ogg (nécessite realplayer, libreplay, sox et oggenc) :
#! /bin/sh

if [ $# -lt 2 ] ; then
  echo "Usage: $0 stream_url outfile.ogg [speedup]"
  exit 1
fi

outfile="$2"

speedup=1
[ $# -gt 2 ] && speedup="$3"
echo "Speedup is: $speedup"

mkdir /tmp/rawstreams-$$ /tmp/wavstreams-$$

LIBC_PATH=/lib/libc.so.6 \
  LIBREPLAY_EMULATE="$speedup" \
  LIBREPLAY_TIMEOUT="30" \
  LIBREPLAY_DIRPATH="/tmp/rawstreams-$$" \
  LD_PRELOAD=/home/d2/download/x86/src/libreplay-0.4/libreplay.so \
  /usr/local/realplay "$1"

for f in /tmp/rawstreams-$$/* ; do
  o_IFS="$IFS"
  IFS="._"
  set -- $f
  freq="$5"
  chans="$7"
  sz="$9"
  IFS="$o_IFS"
  outf=`basename "$f" .raw`.wav
  soxfmt="-w"
  case x"$sz" in
    x8) soxfmt="-b";;
    x32) soxfmt="-l";;
    x64) soxfmt="-d";;
    *) ;;
  esac
  echo "Generating $outf..."
  sox -t raw -s $soxfmt -c $chans -r $freq "$f" -t wav -s -w -c 2 -r 44100 "/tmp/wavstreams-$$/$outf" copy
  rm "$f"
done
rmdir /tmp/rawstreams-$$

echo "Concat streams..."
sox /tmp/wavstreams-$$/realplayer_stream*.wav  -t wav -s -w -c 2 -r 44100 /tmp/out-$$.wav
rm -r /tmp/wavstreams-$$

echo "Encode Ogg..."
oggenc -o "$outfile" /tmp/out-$$.wav
rm /tmp/out-$$.wav