0

I am trying to convert a large number of .flac files into .aiff in order to use them with iTunes. It should be noted that I am doing this on Windows using GIT Bash.

The command that I'm using to convert the files is as below:

for f in *.flac; do "c:/FFmpeg/bin/ffmpeg" -i "$f" -i cover.png -map_metadata 0 "D:\Music\Monstercat\Monstercat 001 - Launch Week (apple)\\${f%.flac}.aiff"; done

The code itself does pretty much what it's supposed to. It cycles through all of the files, grabs the cover image, converts the file to an .aiff, and spits it out in the right folder.

Here's the sample output from one of the conversion cycles:

ffmpeg version N-83410-gb1e2192 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 46.100 / 55. 46.100
  libavcodec     57. 75.100 / 57. 75.100
  libavformat    57. 66.101 / 57. 66.101
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 72.100 /  6. 72.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, flac, from 'Stephen Walking - Monstercat 001 - Launch Week - 7 Still Walking.flac':
  Metadata:
    ENCODER         : Lavf56.15.102
    TITLE           : Still Walking
    ARTIST          : Stephen Walking
    ALBUM           : Monstercat 001 - Launch Week
    track           : 7
    GENRE           : Dubstep
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
    Stream #0:1: Video: png, rgb24(pc), 1024x1024 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
    Metadata:
      comment         : Cover (front)
Input #1, png_pipe, from 'cover.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgb24(pc), 1024x1024 [SAR 72:72 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
Output #0, aiff, to 'D:\Music\Monstercat\Monstercat 001 - Launch Week (apple)\Stephen Walking - Monstercat 001 - Launch Week - 7 Still Walking.aiff':
  Metadata:
    GENRE           : Dubstep
    TITLE           : Still Walking
    ARTIST          : Stephen Walking
    ALBUM           : Monstercat 001 - Launch Week
    track           : 7
    encoder         : Lavf57.66.101
    Stream #0:0: Video: png, rgb24, 1024x1024 [SAR 72:72 DAR 1:1], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.75.100 png
    Stream #0:1: Audio: pcm_s16be (NONE / 0x454E4F4E), 44100 Hz, stereo, s16, 1411 kb/s
    Metadata:
      encoder         : Lavc57.75.100 pcm_s16be
Stream mapping:
  Stream #1:0 -> #0:0 (png (native) -> png (native))
  Stream #0:0 -> #0:1 (flac (native) -> pcm_s16be (native))
Press [q] to stop, [?] for help
frame=    1 fps=1.0 q=-0.0 Lsize=   34668kB time=00:03:21.24 bitrate=1411.2kbits/s speed= 196x
video:1262kB audio:34668kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

As seen, the original file has intact metadata, shown below for comparison...

Metadata:
    ENCODER         : Lavf56.15.102
    TITLE           : Still Walking
    ARTIST          : Stephen Walking
    ALBUM           : Monstercat 001 - Launch Week
    track           : 7
    GENRE           : Dubstep

However, when I import the target file into iTunes, none of the metadata has been preserved. It should be noted that the original command lacked the -map_metadata 0 portion as this was added to see if it would force the metadata to be written. It should also be noted that I have tried exporting the metadata to a text file and then merging it into the target file afterwards with the same result.

Here is the FFprobe ouput from the output file:

ffprobe version N-83410-gb1e2192 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 46.100 / 55. 46.100
  libavcodec     57. 75.100 / 57. 75.100
  libavformat    57. 66.101 / 57. 66.101
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 72.100 /  6. 72.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, aiff, from 'Stephen Walking - Monstercat 001 - Launch Week - 7 Still Walking.aiff':
  Metadata:
    title           : Still Walking
  Duration: 00:03:21.25, start: 0.000000, bitrate: 1411 kb/s
    Stream #0:0: Audio: pcm_s16be, 44100 Hz, 2 channels, s16, 1411 kb/s

For some reason, only the title metadata tag is imported while the rest are ignored. Additionally, when imported into iTunes, the title of the song there reports Stephen Walking - Monstercat 001 - Launch Week - 7 Still Walking.aiff instead of Still Walking.

Any assistance with this would be appreciated. I've been working on this for a few hours now and I'm at a loss.

Also, bonus points to anyone who wants to make my for loop more efficient. The original folder is D:\Music\Monstercat\Monstercat 001 - Launch Week and the target is D:\Music\Monstercat\Monstercat 001 - Launch Week (apple).

Thank you

1

You have to enable tag writing.

c:/FFmpeg/bin/ffmpeg" -i "$f" -i cover.png -map_metadata 0 -write_id3v2 1 "D:\Music\Monstercat\Monstercat 001 - Launch Week (apple)\\${f%.flac}.aiff

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.