Uses ffmpeg to convert all that annoying .FLAC files to MP3 files keeping all the Artist's information in them.

find . -name "*.flac" -exec ffmpeg -i {} -ab 160k -map_metadata 0 -id3v2_version 3 {}.mp3 \;
Uses ffmpeg to convert all that annoying .FLAC files to MP3 files keeping all the Artist's information in them. There's not much more to it.
Sample Output
$ find . -name "*.flac" -exec ffmpeg -i {} -ab 160k -map_metadata 0 -id3v2_version 3 {}.mp3 \;
ffmpeg version 2.8.4 Copyright (c) 2000-2015 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.4 --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-libvo-aacenc --enable-libxvid --enable-vda
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, flac, from './01 The Grateful Dead - Uncle John's Band.flac':
  Metadata:
    TITLE           : Uncle John's Band
    ARTIST          : The Grateful Dead
    ALBUM           : Workingman's Dead (2003 reissue)
    GENRE           : Rock
    COMPOSER        : Bill Kreutzmann;Bob Weir;Jerry Garcia;Phil Lesh;Ron "Pigpen" McKernan
    ENSEMBLE        : The Grateful Dead
    track           : 1
    DATE            : 2001
    ALBUM ARTIST    : The Grateful Dead
  Duration: 00:04:45.33, start: 0.000000, bitrate: 854 kb/s
    Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
Output #0, mp3, to './01 The Grateful Dead - Uncle John's Band.flac.mp3':
  Metadata:
    TIT2            : Uncle John's Band
    TPE1            : The Grateful Dead
    TALB            : Workingman's Dead (2003 reissue)
    TCON            : Rock
    TCOM            : Bill Kreutzmann;Bob Weir;Jerry Garcia;Phil Lesh;Ron "Pigpen" McKernan
    ENSEMBLE        : The Grateful Dead
    TRCK            : 1
    TYER            : 2001
    ALBUM ARTIST    : The Grateful Dead
    TSSE            : Lavf56.40.101
    Stream #0:0: Audio: mp3 (libmp3lame), 44100 Hz, stereo, s16p, 160 kb/s
    Metadata:
      encoder         : Lavc56.60.100 libmp3lame
Stream mapping:
  Stream #0:0 -> #0:0 (flac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
size=    5574kB time=00:04:45.33 bitrate= 160.0kbits/s    
video:0kB audio:5573kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.015331%

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: