Skip to content

Instantly share code, notes, and snippets.

@rhiguchi
Created April 1, 2012 08:27
Show Gist options
  • Save rhiguchi/2273395 to your computer and use it in GitHub Desktop.
Save rhiguchi/2273395 to your computer and use it in GitHub Desktop.
NHKネットラジオをVLCで録音するスクリプト ref: http://qiita.com/items/549b42c8b361807d96a2
recording.sh 10
45 6 * * 1-5 /Users/flo_jack/NHK_Radio/recording.sh 15
#! /bin/bash
DEST_FILE_NAME_BASE=`date +%Y%m%d-%H%M`
## 録音時間
if [ $# = 0 ]
then
RECORDING_MINUTES=15
else
RECORDING_MINUTES=$1
fi
DEST_DIR="/Users/flo_jack/NHK_Radio"
DEST_FILE="$DEST_DIR/$DEST_FILE_NAME_BASE.mp3"
# ストリームには10〜20秒のタイムラグがあるため、30秒余分に保存
RECORDING_TIME=$(($RECORDING_MINUTES * 60 + 30))
# らじる★らじるのラジオ第2放送ストリーム
STREAM_SOURCE="mms://a57.l12993246056.c129932.g.lm.akamaistream.net/D/57/129932/v0001/reflector:46056"
# ラジオ第1ストリーム
#STREAM_SOURCE="mms://a33.l12993146032.c129931.g.lm.akamaistream.net/D/33/129931/v0001/reflector:46032"
# NHK-FMストリーム
#STREAM_SOURCE="mms://a52.l12993346051.c129933.g.lm.akamaistream.net/D/52/129933/v0001/reflector:46051"
if [ ! -e "$DEST_DIR" ]
then
mkdir "$DEST_DIR"
fi
/usr/local/bin/vlc -I rc $STREAM_SOURCE :sout="#transcode{acodec=mp3}:std{access=file,mux=raw,dst=$DEST_FILE}" --run-time $RECORDING_TIME vlc://quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment