Just a small function to create mp3-files with ffmpeg
… Just a small function or snippet to add to your .bash_functions
file.
To convert the sound, the code is just:
ffmpeg -i "$1" -ab 320k $(echo "${1%.*}.mp3"
That just about it… But, to make a function of it - let’s add a few more xtras.
Check if ffmpeg
is installed…
[[ ! `type ffmpeg 2> /dev/null` ]] && echo "$FUNCNAME: Please install 'ffmpeg'..." && return 1;
And convert blanks to under_scores…
sed 's/[[:space:]]/_/g'
Now together, the function will look like:
1 2 3 4 5 6 |
|
When using 2mp3()
- the mp3 file info will look something like:
Screendump from iTunes.
To use other/lower values than 320… there are a few example in the post: Convert Sound to Mp3 With ‘Ffmpeg’.
Happy hacking…
/Eric