Record internet radio with VLC

    Table of contents
    No headers

    I needed to record a CBC radio piece today. For most cases, it appears the easiest route is to use streamtuner and streamripper, however there is something about my particular computer or CBC’s streaming style that made it difficult for me. Since it took a couple of hours to figure it all out, I figured I’d better save it for future reference. So here is a vlc only method which works, but with more clicks and it’s is easier to select a combination of options that don’t work than do. This is the combination which finally worked for me:

    • start VLC
    • File > Open Network Stream
    • for HTTP/HTTPS/FTP/MMS: http://www.cbc.ca/listen/streams/r1_whitehorse_32.html
    • check ’steam/save’, select ‘Settings’, then ‘Outputs’:
    • check ‘Play Locally’
    • check ‘File’, set filename as you wish
    • Encapsulation method: ‘Raw’
    • check ‘Audio codec’, and select ‘mpga’ from the list, bitrate as you like (96kb is okay for this particular stream)

    It’s the audio codec part which tripped me up the most, even though I was saving mp3 selecting mp3 as a code yields a 0 byte file.

    For command line use, copy the source and destination urls from the dialogs created above, however it is necessary to change the syntax somewhat. Namely the :sout option needs to be single quoted.

    vlc http://www.cbc.ca/listen/streams/r1_whitehorse_32.htm ‘:sout=#transcode{acodec=mpga,ab=96,channels=2}:duplicate{dst=display,dst=std{access=file,mux=raw,dst=”/home/matt/Radio/cbc-north.mp3″}’

    Here is the same in a bash script, you should only need to edit the INSTREAM and OUTFILE lines to use elsewhere

    #!/bin/sh
    NOW=$(date +%F_%k-%M)
    INSTREAM=http://www.cbc.ca/listen/streams/r1_...ehorse_32.html
    OUTFILE=/home/shared/Audio/Radio/cbc-north_$NOW.mp3
    echo …
    echo …Recording CBC North internet radio to
    echo    $OUTFILE
    echo …expect a 5 second delay before hearing anything
    echo …and a few “access_mms” errors prior to that.
    echo …
    /usr/bin/vlc $INSTREAM
    ‘:sout=#transcode{acodec=mpga,ab=96,channels=2}:duplicate{dst=display,dst=std{access=file,mux=raw,dst=”‘$OUTFILE’”}}’

    Sources:

        Send feedback