Capturing rtmp to m4a on OSX

Computing 2014.12.11 17:17

After trying several ways to achieve the mission: libav, rtmpdump, etc. I finally landed on a method that utilizes vlc. Bravo vlc!!!


1. Install VLC

http://www.videolan.org/vlc/


2. Run following command:

/Applications/VLC.app/Contents/MacOS/VLC -I dummy rtmp://ebsandroid.ebs.co.kr/fmradiofamilypc/familypc1m vlc://quit --no-sout-video --sout-audio --no-sout-rtp-sap --no-sout-standard-sap --ttl=1 --sout-keep --sout "#transcode{acodec=s16l,channels=2}:std{access=file,mux=wav,dst=1.wav}" 2> /dev/null


3. Convert resulting wav file to m4a file:

/usr/bin/afconvert -f mp4f -d aac -q 127 1.wav 1.m4a


Why not let vlc directly save output in mp3 format?

Because, the sound quality is not quite good. It left me with no choice but to record using wav format and then convert it to aac format.



#!/bin/bash


ABSPATH_SELF=$(cd $(dirname $0); pwd -P)


if [ $# -ne 2 ];

then

    echo "Usage: $0 filename duration(unit:min)"

    exit 1

fi


FILENAMEROOT=$1

DURATION=$(($2 * 60))


DATE=$(date +"%Y-%m-%d")

WEEKDAY=$(date +"%A")


if [ "${WEEKDAY}" == "Monday" -o "${WEEKDAY}" == "Tuesday" -o "${WEEKDAY}" == "Wednesday" ];

then

    LEVEL="초급"

else

    LEVEL="중급"

fi


FILENAME1="${ABSPATH_SELF}/${FILENAMEROOT}-${DATE}.m4a"

FILENAME2="${ABSPATH_SELF}/${FILENAMEROOT}-${DATE}(${WEEKDAY}-${LEVEL}).m4a"

FILENAME3="${ABSPATH_SELF}/${FILENAMEROOT}-${DATE}(${WEEKDAY_KOR}).m4a"


EBS_RADIO_URL="rtmp://ebsandroid.ebs.co.kr/fmradiofamilypc/familypc1m"


TMP_WAVFILE="${FILENAME1}.wav"


/Applications/VLC.app/Contents/MacOS/VLC -I dummy ${EBS_RADIO_URL} vlc://quit --no-sout-video --sout-audio --no-sout-rtp-sap --no-sout-standard-sap --ttl=1 --sout-keep --sout "#transcode{acodec=s16l,channels=2}:std{access=file,mux=wav,dst=${TMP_WAVFILE}}" 2> /dev/null &


VLC_PID=$!


sleep ${DURATION}


kill -TERM ${VLC_PID}


sleep 10


/usr/bin/afconvert -f mp4f -d aac -q 127 ${TMP_WAVFILE} ${FILENAME1}


if [ "${FILENAMEROOT}" == "Chinese" -o "${FILENAMEROOT}" == "Japanese" ];

then

    mv ${FILENAME1} ${FILENAME2}

else

    mv ${FILENAME1} ${FILENAME3}

fi


rm -f ${TMP_WAVFILE}



EBS streaming rtmp address list


rtmp://ebsandroid.nefficient.com/groundwavefamilypc/familypc1m"; // 지상파HD

rtmp://ebsandroid.nefficient.com/ebsufamilypc/familypc1m"; //EBSu HD

rtmp://ebsandroid.nefficient.com/fmradiofamilypc/familypc1m"; //FM 라디오 SD

rtmp://ebsandroid.nefficient.com/plus1familypc/familypc1m"; //Plus1 SD

rtmp://ebsandroid.nefficient.com/plus2familypc/familypc1m"; //Plus2 SD

rtmp://ebsandroid.nefficient.com/plus3familypc/familypc1m"; //Plus3 SD



저작자 표시 비영리 변경 금지
신고
Trackback 0 : Comment 0

Write a comment


Stellarium

잡동사니 2014.11.26 02:46

천체도 프로그램.

플라네타리움.

http://www.stellarium.org


저작자 표시 비영리 변경 금지
신고
Trackback 0 : Comment 0

Write a comment


사파리가 종료시 열려 있던 탭을 다시 여는 것을 방지하기

Computing 2014.11.19 10:21

defaults write com.apple.Safari NSQuitAlwaysKeepsWindows -bool false

저작자 표시 비영리 변경 금지
신고
Trackback 0 : Comment 0

Write a comment


OSX 에서 zip 파일을 만들 경우 함께 따라붙는 __MACOSX 폴더 없이 압축하기

Computing 2014.09.30 17:03

zip -r -X 20140927.zip 20140927/

저작자 표시 비영리 변경 금지
신고
Trackback 0 : Comment 0

Write a comment


Color Scheme for iTerm2

Computing 2014.04.23 01:51

Site: http://iterm2colorschemes.com

My Favorite: Solarized theme with modified selection color

In case the original site is shut down or for any other unfortunate event,

Here goes installation instructions from the original site:

Installation Instructions

To install:

  • Launch iTerm 2. Get the latest version at iterm2.com
  • Type CMD+i
  • Navigate to Colors tab
  • Click on Load Presets
  • Click on Import
  • Select the .itermcolors file(s) of the scheme(s) you'd like to use
  • Click on Load Presets and choose a color scheme


mbadolato-iTerm2-Color-Schemes-2567792.zip



저작자 표시 비영리 변경 금지
신고
Trackback 0 : Comment 0

Write a comment

티스토리 툴바