Posts with the tag mac os x:

How to Create Bash Function ?

First step: create a utilities.sh file to add all your bash functions in it. 2nd step: add your bash function/s like this. ## utilities.sh convertMP4toMP3(){ echo -n "Enter source mp4 file : " read sourceFile echo -n "Enter destination mp3 file : " read destFile avconv -i $sourceFile -vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 $destFile } I created a bash function to convert mp4 video file to mp3 audio file from command line. 3rd step: source the utilities.sh Bash file source utilities.sh Finally, you can call the function from the command line (terminal) and use it like this.

Convert Mp4 to Mp3 in Linux Terminal

First things first, install the required software packages. sudo apt-get install ffmpeg && sudo apt-get install libavcodec-extra-53 Then use it. For FFmpeg with Constant Bitrate Encoding (CBR) ffmpeg -i video.mp4 -vn \ -acodec libmp3lame -ac 2 -ab 160k -ar 48000 \ audio.mp3 or if you want to use Variable Bitrate Encoding (VBR) ffmpeg -i video.mp4 -vn \ -acodec libmp3lame -ac 2 -qscale:a 4 -ar 48000 \ audio.mp3 If it says ffmpeg is depricated use this command instead. avconv -i video.mp4 -vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 audio.mp3 The meaning of arguments argv meaning -i input file name -vn disable video recording -acodec force audio codec to libmp3lame -ac set the number of audio channels -ar set the audio sampling frequency I hope this helps.