Monday, December 29, 2014

Dump audio to wav format using mplayer

mplayer input.mp4 -vc null -vo null -ao pcm:fast:waveheader:file=audio.wav

Play raw audio using mplayer

To play raw pcm file using mplayer use below command, which plays a pcm file "audio.pcm" whose sample rate is 192000 KHz, 32 bit, stereo
mplayer -rawaudio rate=192000:channels=2:samplesize=4 -format s32le -demuxer rawaudio audio.pcm

Friday, December 19, 2014

How to use bash function defined in .bashrc file into bash script

First define function in .bashrc and then export it
d2h(){
  echo "obase=16; $@"|bc
}
export -f d2h
Above function converts decimal to hex and then export it, so that it can be used from other bash scripts