Created
November 23, 2016 10:30
-
-
Save tomisacat/fac7c1aabd245723c5da2a7631b18ce5 to your computer and use it in GitHub Desktop.
Convert mp3 to m4a with AAC codec and 128kb/s bitrate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
if ARGV.length < 1 | |
puts "Please input file name." | |
exit | |
end | |
mp3_name = ARGV[0] + "" | |
m4a_name = mp3_name.split(".")[0] + ".m4a" | |
puts "******************************************" | |
puts "Converting #{mp3_name} to #{m4a_name} ..." | |
puts "******************************************" | |
command = "ffmpeg -i #{mp3_name} -c:a aac -b:a 128k #{m4a_name}" | |
exec command |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to use?
copy this file to destination and then
make sure that you have installed
ffmpeg
(which could be installed throughhomebrew
).then, just type the script name and the name of mp3 file like
it will automatically convert
music.mp3
tomusic.m4a
withAAC
codec and128kb/s
bitrate.