LoginSignup
0
1

More than 3 years have passed since last update.

インターネットラジオを録音する。

Last updated at Posted at 2021-02-21

インターネットラジオを録音する

初投稿です。。
好きな歌手や、DJの方のインターネットラジオ(ラジコ、tunein等)を録音したい、
その際のあれやこれやと四苦八苦した時のメモです。(この方法がベストかは分からず。。)

.m3u8 マニフェスト ファイルのURLを確認

 インターネットで録音したいサイトのマニフェストファイルを確認します。

シェルの作成

録音開始用

recording_IPradio.sh
   #!/usr/bin/bash

   M3U8URL=${1}  // m3u8ファイルのへのurlパス
   OUTFILE=${2} // 出力したいmp3ファイル名

  ffmpeg -y -i ${M3U8URL} -write_xing 0 /mnt/${OUTFILE}.mp3 & 

録音終了用

recording_IPradio_kill.sh
   #!/usr/bin/bash

   kill -9 `ps -ef | grep /recording_IPradio.sh | grep -v grep | awk '{ print $2 }'`  // 録音用シェルをkillする
   kill -9 `ps -ef | grep ffmpeg | grep -v grep | grep -v bash | awk '{ print $2 }'` // ffmpegをkillする

cronへの登録 (12:00~13:00で録音する場合)

遅延を考慮して、開始終了時刻を調整します。

cron設定
59 11 * * * bash -l /home/pi/recording_IPradio.sh "m3u8のurlパス" "mp3ファイル名" > /dev/null
01 13 * * * bash -l /home/pi/recording_IPradio_kill.sh > /dev/null

 cronの開始~終了時間中は指定したmp3ファイルに音声が出力され続けます。
 今のところ、このやり方でうまく録音できています。
 
 

0
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1