Skip to content

Instantly share code, notes, and snippets.

@matchy256
Last active October 15, 2025 07:25
Show Gist options
  • Select an option

  • Save matchy256/9515cecbea40918add594203dc61406c to your computer and use it in GitHub Desktop.

Select an option

Save matchy256/9515cecbea40918add594203dc61406c to your computer and use it in GitHub Desktop.

Revisions

  1. matchy256 revised this gist Jun 22, 2022. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions rec_nhk.sh
    Original file line number Diff line number Diff line change
    @@ -82,5 +82,9 @@ case $channel in
    ;;
    esac

    # MP3に変換する場合
    ffmpeg -loglevel quiet -y -t ${DURATION} -i ${aspx} -acodec libmp3lame -ab 128k "${outdir}/${PREFIX}_${date}.mp3"
    #avconv -loglevel quiet -y -t ${DURATION} -i ${aspx} -acodec mp3 -ab 128k "${outdir}/${PREFIX}_${date}.mp3"

    # AACでとりだす場合
    #ffmpeg -loglevel quiet -y -t ${DURATION} -i ${aspx} -vn -acodec copy -bsf:a aac_adtstoasc "${outdir}/${PREFIX}_${date}.m4a"
  2. matchy256 revised this gist Jun 22, 2022. 1 changed file with 17 additions and 38 deletions.
    55 changes: 17 additions & 38 deletions rec_nhk.sh
    Original file line number Diff line number Diff line change
    @@ -26,76 +26,55 @@ fi
    #
    case $channel in
    "NHK1")
    aspx="https://nhkradioakr1-i.akamaihd.net/hls/live/511633/1-r1/1-r1-01.m3u8"
    aspx="https://radio-stream.nhk.jp/hls/live/2023229/nhkradiruakr1/master48k.m3u8"
    ;;
    "NHK2")
    aspx="https://nhkradioakr2-i.akamaihd.net/hls/live/511929/1-r2/1-r2-01.m3u8"
    aspx="https://radio-stream.nhk.jp/hls/live/2023501/nhkradiruakr2/master48k.m3u8"
    ;;
    "FM")
    aspx="https://nhkradioakfm-i.akamaihd.net/hls/live/512290/1-fm/1-fm-01.m3u8"
    aspx="https://radio-stream.nhk.jp/hls/live/2023507/nhkradiruakfm/master48k.m3u8"
    ;;
    "NHK1_SAPPORO")
    aspx="https://nhkradioikr1-i.akamaihd.net/hls/live/512098/1-r1/1-r1-01.m3u8"
    ;;
    "NHK2_SAPPORO")
    aspx="https://nhkradioakr2-i.akamaihd.net/hls/live/511929/1-r2/1-r2-01.m3u8"
    aspx="https://radio-stream.nhk.jp/hls/live/2023545/nhkradiruikr1/master48k.m3u8"
    ;;
    "FM_SAPPORO")
    aspx="https://nhkradioikfm-i.akamaihd.net/hls/live/512100/1-fm/1-fm-01.m3u8"
    aspx="https://radio-stream.nhk.jp/hls/live/2023546/nhkradiruikfm/master48k.m3u8"
    ;;
    "NHK1_SENDAI")
    aspx="https://nhkradiohkr1-i.akamaihd.net/hls/live/512075/1-r1/1-r1-01.m3u8"
    ;;
    "NHK2_SENDAI")
    aspx="https://nhkradioakr2-i.akamaihd.net/hls/live/511929/1-r2/1-r2-01.m3u8"
    aspx="https://radio-stream.nhk.jp/hls/live/2023543/nhkradiruhkr1/master48k.m3u8"
    ;;
    "FM_SENDAI")
    aspx="https://nhkradiohkfm-i.akamaihd.net/hls/live/512076/1-fm/1-fm-01.m3u8"
    aspx="https://radio-stream.nhk.jp/hls/live/2023544/nhkradiruhkfm/master48k.m3u8"
    ;;
    "NHK1_NAGOYA")
    aspx="https://nhkradiockr1-i.akamaihd.net/hls/live/512072/1-r1/1-r1-01.m3u8"
    ;;
    "NHK2_NAGOYA")
    aspx="https://nhkradioakr2-i.akamaihd.net/hls/live/511929/1-r2/1-r2-01.m3u8"
    aspx="https://radio-stream.nhk.jp/hls/live/2023510/nhkradiruckr1/master48k.m3u8"
    ;;
    "FM_NAGOYA")
    aspx="https://nhkradiockfm-i.akamaihd.net/hls/live/512074/1-fm/1-fm-01.m3u8"
    aspx="https://radio-stream.nhk.jp/hls/live/2023511/nhkradiruckfm/master48k.m3u8"
    ;;
    "NHK1_OSAKA")
    aspx="https://nhkradiobkr1-i.akamaihd.net/hls/live/512291/1-r1/1-r1-01.m3u8"
    ;;
    "NHK2_OSAKA")
    aspx="https://nhkradioakr2-i.akamaihd.net/hls/live/511929/1-r2/1-r2-01.m3u8"
    aspx="https://radio-stream.nhk.jp/hls/live/2023508/nhkradirubkr1/master48k.m3u8"
    ;;
    "FM_OSAKA")
    aspx="https://nhkradiobkfm-i.akamaihd.net/hls/live/512070/1-fm/1-fm-01.m3u8"
    aspx="https://radio-stream.nhk.jp/hls/live/2023509/nhkradirubkfm/master48k.m3u8"
    ;;
    "NHK1_HIROSHIMA")
    aspx="https://nhkradiofkr1-i.akamaihd.net/hls/live/512086/1-r1/1-r1-01.m3u8"
    ;;
    "NHK2_HIROSHIMA")
    aspx="https://nhkradioakr2-i.akamaihd.net/hls/live/511929/1-r2/1-r2-01.m3u8"
    aspx="https://radio-stream.nhk.jp/hls/live/2023512/nhkradirufkr1/master48k.m3u8"
    ;;
    "FM_IROSHIMA")
    aspx="https://nhkradiofkfm-i.akamaihd.net/hls/live/512087/1-fm/1-fm-01.m3u8"
    aspx="https://radio-stream.nhk.jp/hls/live/2023513/nhkradirufkfm/master48k.m3u8"
    ;;
    "NHK1_MATSUYAMA")
    aspx="https://nhkradiozkr1-i.akamaihd.net/hls/live/512103/1-r1/1-r1-01.m3u8"
    ;;
    "NHK2_MATSUYAMA")
    aspx="https://nhkradioakr2-i.akamaihd.net/hls/live/511929/1-r2/1-r2-01.m3u8"
    aspx="https://radio-stream.nhk.jp/hls/live/2023547/nhkradiruzkr1/master48k.m3u8"
    ;;
    "FM_MATSUYAMA")
    aspx="https://nhkradiozkfm-i.akamaihd.net/hls/live/512106/1-fm/1-fm-01.m3u8"
    aspx="https://radio-stream.nhk.jp/hls/live/2023548/nhkradiruzkfm/master48k.m3u8"
    ;;
    "NHK1_FUKUOKA")
    aspx="https://nhkradiolkr1-i.akamaihd.net/hls/live/512088/1-r1/1-r1-01.m3u8"
    ;;
    "NHK2_FUKUOKA")
    aspx="https://nhkradioakr2-i.akamaihd.net/hls/live/511929/1-r2/1-r2-01.m3u8"
    aspx="https://radio-stream.nhk.jp/hls/live/2023541/nhkradirulkr1/master48k.m3u8"
    ;;
    "FM_FUKUOKA")
    aspx="https://nhkradiolkfm-i.akamaihd.net/hls/live/512097/1-fm/1-fm-01.m3u8"
    aspx="https://radio-stream.nhk.jp/hls/live/2023542/nhkradirulkfm/master48k.m3u8"
    ;;
    *)
    echo "failed channel"
  3. matchy256 revised this gist Sep 22, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion rec_nhk.sh
    Original file line number Diff line number Diff line change
    @@ -104,4 +104,4 @@ case $channel in
    esac

    ffmpeg -loglevel quiet -y -t ${DURATION} -i ${aspx} -acodec libmp3lame -ab 128k "${outdir}/${PREFIX}_${date}.mp3"
    #avconv -loglevel quiet -y -t ${DURATION} -i ${aspx} -acodec libmp3lame -ab 128k "${outdir}/${PREFIX}_${date}.mp3"
    #avconv -loglevel quiet -y -t ${DURATION} -i ${aspx} -acodec mp3 -ab 128k "${outdir}/${PREFIX}_${date}.mp3"
  4. matchy256 created this gist Sep 5, 2017.
    107 changes: 107 additions & 0 deletions rec_nhk.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,107 @@
    #!/bin/bash

    pid=$$
    date=`date '+%Y-%m-%d-%H_%M'`
    outdir="."

    if [ $# -le 1 ]; then
    echo "usage : $0 channel_name duration(minuites) [outputdir] [prefix]"
    exit 1
    fi

    if [ $# -ge 2 ]; then
    channel=$1
    DURATION=`expr $2 \* 60 + 15`
    fi
    if [ $# -ge 3 ]; then
    outdir=$3
    fi
    PREFIX=${channel}
    if [ $# -ge 4 ]; then
    PREFIX=$4
    fi

    #
    # set channel
    #
    case $channel in
    "NHK1")
    aspx="https://nhkradioakr1-i.akamaihd.net/hls/live/511633/1-r1/1-r1-01.m3u8"
    ;;
    "NHK2")
    aspx="https://nhkradioakr2-i.akamaihd.net/hls/live/511929/1-r2/1-r2-01.m3u8"
    ;;
    "FM")
    aspx="https://nhkradioakfm-i.akamaihd.net/hls/live/512290/1-fm/1-fm-01.m3u8"
    ;;
    "NHK1_SAPPORO")
    aspx="https://nhkradioikr1-i.akamaihd.net/hls/live/512098/1-r1/1-r1-01.m3u8"
    ;;
    "NHK2_SAPPORO")
    aspx="https://nhkradioakr2-i.akamaihd.net/hls/live/511929/1-r2/1-r2-01.m3u8"
    ;;
    "FM_SAPPORO")
    aspx="https://nhkradioikfm-i.akamaihd.net/hls/live/512100/1-fm/1-fm-01.m3u8"
    ;;
    "NHK1_SENDAI")
    aspx="https://nhkradiohkr1-i.akamaihd.net/hls/live/512075/1-r1/1-r1-01.m3u8"
    ;;
    "NHK2_SENDAI")
    aspx="https://nhkradioakr2-i.akamaihd.net/hls/live/511929/1-r2/1-r2-01.m3u8"
    ;;
    "FM_SENDAI")
    aspx="https://nhkradiohkfm-i.akamaihd.net/hls/live/512076/1-fm/1-fm-01.m3u8"
    ;;
    "NHK1_NAGOYA")
    aspx="https://nhkradiockr1-i.akamaihd.net/hls/live/512072/1-r1/1-r1-01.m3u8"
    ;;
    "NHK2_NAGOYA")
    aspx="https://nhkradioakr2-i.akamaihd.net/hls/live/511929/1-r2/1-r2-01.m3u8"
    ;;
    "FM_NAGOYA")
    aspx="https://nhkradiockfm-i.akamaihd.net/hls/live/512074/1-fm/1-fm-01.m3u8"
    ;;
    "NHK1_OSAKA")
    aspx="https://nhkradiobkr1-i.akamaihd.net/hls/live/512291/1-r1/1-r1-01.m3u8"
    ;;
    "NHK2_OSAKA")
    aspx="https://nhkradioakr2-i.akamaihd.net/hls/live/511929/1-r2/1-r2-01.m3u8"
    ;;
    "FM_OSAKA")
    aspx="https://nhkradiobkfm-i.akamaihd.net/hls/live/512070/1-fm/1-fm-01.m3u8"
    ;;
    "NHK1_HIROSHIMA")
    aspx="https://nhkradiofkr1-i.akamaihd.net/hls/live/512086/1-r1/1-r1-01.m3u8"
    ;;
    "NHK2_HIROSHIMA")
    aspx="https://nhkradioakr2-i.akamaihd.net/hls/live/511929/1-r2/1-r2-01.m3u8"
    ;;
    "FM_IROSHIMA")
    aspx="https://nhkradiofkfm-i.akamaihd.net/hls/live/512087/1-fm/1-fm-01.m3u8"
    ;;
    "NHK1_MATSUYAMA")
    aspx="https://nhkradiozkr1-i.akamaihd.net/hls/live/512103/1-r1/1-r1-01.m3u8"
    ;;
    "NHK2_MATSUYAMA")
    aspx="https://nhkradioakr2-i.akamaihd.net/hls/live/511929/1-r2/1-r2-01.m3u8"
    ;;
    "FM_MATSUYAMA")
    aspx="https://nhkradiozkfm-i.akamaihd.net/hls/live/512106/1-fm/1-fm-01.m3u8"
    ;;
    "NHK1_FUKUOKA")
    aspx="https://nhkradiolkr1-i.akamaihd.net/hls/live/512088/1-r1/1-r1-01.m3u8"
    ;;
    "NHK2_FUKUOKA")
    aspx="https://nhkradioakr2-i.akamaihd.net/hls/live/511929/1-r2/1-r2-01.m3u8"
    ;;
    "FM_FUKUOKA")
    aspx="https://nhkradiolkfm-i.akamaihd.net/hls/live/512097/1-fm/1-fm-01.m3u8"
    ;;
    *)
    echo "failed channel"
    exit 1
    ;;
    esac

    ffmpeg -loglevel quiet -y -t ${DURATION} -i ${aspx} -acodec libmp3lame -ab 128k "${outdir}/${PREFIX}_${date}.mp3"
    #avconv -loglevel quiet -y -t ${DURATION} -i ${aspx} -acodec libmp3lame -ab 128k "${outdir}/${PREFIX}_${date}.mp3"