리눅스에서 EBS 예약녹음 방법

2013 년들어  EBS 의 기존 mms 방식으로 서비스 하지 않는다. 
rtmp 방식으로 변경하였는데 아래 처럼 하면 예약 녹음이 가능하다.
2곳의 참고 사이트를 참조하여 나름대로 수정하였다.
좋은 정보를 공유해준 네티즌들에게 감사의 말씀을....


1) rtmpdump, ffmpeg, lame 설치 
$ sudo apt-get install rtmpdump
$ sudo apt-get install ffmpeg
$ sudo apt-get install lame  ==> 안될경우 http://lame.sourceforge.net/download.php 에서 소스 다운로드 하여 설치

2) 스크립트 파일 작성  (ebs_recorder 란 이름으로 저장)
  1. #!/bin/bash
  2. DATE=`date +%Y%m%d`
  3. EBSURL="rtmp://ebsandroid.ebs.co.kr:1935/fmradiofamilypc/familypc1m"
  4. FPATH="$HOME/EBS/$DATE"
  5. FNAME="$1_$DATE"
  6. RECTIME=$(($2*60))
  7. FLVFNAME="$FPATH/$FNAME.flv"
  8. WAVFNAME="$FPATH/$FNAME.wav"
  9. MP3FNAME="$FPATH/$FNAME.mp3"
  10. RTMP="/usr/bin/rtmpdump"
  11. MPLAYER="/usr/bin/mplayer"
  12. LAME="/usr/bin/lame"

  13. if [ ! -d $FPATH ] 
  14. then
  15.     mkdir -p $FPATH
  16. fi
  17. $RTMP  -r  $EBSURL -o $FLVFNAME &
  18. pid_player=$!    #child process PID
  19. echo "PID : $pid_player"
  20. #sleep `expr $RECTIME \* 60`
  21. sleep $RECTIME
  22. kill  $pid_player

  23. #convert to mp3
  24. ffmpeg -i $FLVFNAME -acodec pcm_s16le -ac 2 -ab 128 -vn -y $WAVFNAME
  25. $LAME -h $WAVFNAME $MP3FNAME > /dev/null 2>&1
  26. rm -f $FLVFNAME
  27. rm -f $WAVFNAME


 ebs_recorder  file_prefix rec_time  ==> rec_time은 분단위.
ex)ebs_recorder  EasyEnglish 20   ==> EasyEnglish_20121010.mp3 를 20분간 저장.

3) crontab 작성  (crontab -e)
0 6 * * 1-6 $HOME/EBS/ebs_recorder EarEnglish 30
30 6 * * 1-6 $HOME/EBS/ebs_recorder EasyWriting 20
50 6 * * 1-6 $HOME/EBS/ebs_recorder PocketEnglish 10
0 7 * * 1-6 $HOME/EBS/ebs_recorder MouseEnglish 20
20 7 * * 1-6 $HOME/EBS/ebs_recorder EasyEnglish 20
40 7 * * 1-6 $HOME/EBS/ebs_recorder PowerEnglish 20
0 8 * * 1-6 $HOME/EBS/ebs_recorder MorningSpecial_1 60
0 9 * * 1-6 $HOME/EBS/ebs_recorder  MorningSpecial_2 56
0 21 * * 1-6 $HOME/EBS/ebs_recorder EnglishGoGo 56
50 22 * * 1-6 $HOME/EBS/ebs_recorder  EBSWorldNews 10
20 0 * * 1-6 $HOME/EBS/ebs_recorder BusinessEnglish 20

(참고 사이트)
http://xucxo.blogspot.kr/2010/08/ebs-lame-mp3gain-mplayer.html
http://elegwance.com/blog/recording-ebs-radio/

댓글

이 블로그의 인기 게시물

구어체 표현 85가지

Debian Lenny install-including wireless