Sunday, July 14, 2019

HOWTO - on osx convert WAV to MP3 for car audio system

ref: http://apple.stackexchange.com/questions/26099/is-there-a-way-to-convert-audio-files-in-mac-os-x-or-the-command-line-without-us

## PREP ##
# linux
$ sudo apt install ffmpeg
# osx
$ brew install ffmpeg

Warning: You are using a pre-release version of Xcode.
You may encounter build failures or other breakages.
Please create pull-requests instead of filing issues.
==> Installing dependencies for ffmpeg: x264, xvid
==> Installing ffmpeg dependency: x264
==> Downloading https://homebrew.bintray.com/bottles/x264-r2668.el_capitan.bottl
######################################################################## 100.0%
==> Pouring x264-r2668.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/x264/r2668: 10 files, 3.3M
==> Installing ffmpeg dependency: xvid
==> Downloading https://homebrew.bintray.com/bottles/xvid-1.3.4.el_capitan.bottl
######################################################################## 100.0%
==> Pouring xvid-1.3.4.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/xvid/1.3.4: 9 files, 1.3M
==> Installing ffmpeg
==> Downloading https://homebrew.bintray.com/bottles/ffmpeg-3.1.2.el_capitan.bot
######################################################################## 100.0%
==> Pouring ffmpeg-3.1.2.el_capitan.bottle.tar.gz
==> Caveats
The native FFmpeg AAC encoder has been stable since FFmpeg 3.0. If you
were using libvo-aacenc or libaacplus, both of which have been dropped in
FFmpeg 3.0, please consider switching to the native encoder (-c:a aac),
fdk-aac (-c:a libfdk_aac, ffmpeg needs to be installed with the
--with-fdk-aac option), or faac (-c:a libfaac, ffmpeg needs to be
installed with the --with-faac option).

See the announcement
https://ffmpeg.org/index.html#removing_external_aac_encoders for details,
and https://trac.ffmpeg.org/wiki/Encode/AAC on best practices of encoding
AAC with FFmpeg.
==> Summary
🍺  /usr/local/Cellar/ffmpeg/3.1.2: 236 files, 50.1M

# first time run, if error, lame/lib/libmp3lame.0.dylib not found, reinstall lame
# osx
$ sudo brew uninstall lame
$ sudo brew install lame

## USAGE ##

$ ffmpeg -i leungjok.wav -codec:a libmp3lame -qscale:a 2 leungjok.mp3
ffmpeg version 3.1.2 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.3.0 (clang-703.0.31)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.1.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --disable-lzma --enable-vda
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Guessed Channel Layout for Input Stream #0.0 : mono
Input #0, wav, from 'LEUNGJOK.WAV':
  Duration: 00:01:07.55, bitrate: 352 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 22050 Hz, 1 channels, s16, 352 kb/s
[mp3 @ 0x7f8d0a82e200] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, mp3, to 'leungjok.mp3':
  Metadata:
    TSSE            : Lavf57.41.100
    Stream #0:0: Audio: mp3 (libmp3lame), 22050 Hz, mono, s16p
    Metadata:
      encoder         : Lavc57.48.101 libmp3lame
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
size=     445kB time=00:01:07.55 bitrate=  53.9kbits/s speed= 141x    
video:0kB audio:444kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.049891%







Labels: , , , , , , , , , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home