1

A lot of audio programs, such as Audacity, support encoding files as AIFF (Audio Interchange File Format, developed by Apple Inc.).

However, I need specifically an AIFF file that has been compressed with ima4, making it an AIFC file.

The internet seems to be nearly clueless about AIFC and ima4. "convert to AIFC" (with quotes) yields exactly 0 results on Google (3M for MP3, 90K for WAV, 45K for FLAC, ...).

Possible solutions:

  • ffmpeg. I know ffmpeg -i wavefile.wav -f aiff wavefile.aiff converts to AIFF but I can't figure out how to specify the compression algorithm.
  • afconvert. According to here, we can use afconvert -f AIFC -d ima4 [file]. But this is a Mac-only program and I only have access to Windows and Linux Mint machines.
  • afftools. See here. This strangely seems to be a Fedora-only program, and I once again can't find anything on it on Google (if it even does what I want).
  • Adobe Audition. See here. Once again I do not own this paid-for software.
1
  • I should add that, in my tests, VLC had no problem playing AIFC ima4 encoded files
    – xjcl
    Sep 16, 2018 at 21:44

1 Answer 1

4

I thought I'd take a crack at an ffmpeg solution since it's always proved itself to be infinitely versatile for me.

A cursory search of the ffmpeg docs found no useful references to ima4. However, I then realised that ima4 refers to the ADPCM IMA QuickTime codec. Back to the ffmpeg docs, and this appears on the list of supported audio codecs.

Now we know what ffmpeg thinks the codec is called, but not how to refer to it. Running ffmpeg -encoders produces a list of all codecs for which encoding is supported, along with their identifiers. In our case, we can see:

$ ffmpeg -encoders | grep "ADPCM IMA QuickTime"
 A..... adpcm_ima_qt         ADPCM IMA QuickTime

Great! Now we know to tell ffmpeg to use the adpcm_ima_qt codec. Which is as simple as:

$ ffmpeg -i file.wav -c:a adpcm_ima_qt file.aiff
Input #0, wav, from 'file.wav':
  Duration: 00:00:54.31, bitrate: 1411 kb/s
    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> adpcm_ima_qt (native))
Press [q] to stop, [?] for help
Output #0, aiff, to 'file.aiff':
  Metadata:
    encoder         : Lavf58.12.100
    Stream #0:0: Audio: adpcm_ima_qt (ima4 / 0x34616D69), 44100 Hz, stereo, s16p, 352 kb/s
    Metadata:
      encoder         : Lavc58.18.100 adpcm_ima_qt
size=    2485kB time=00:00:54.31 bitrate= 374.9kbits/s speed= 306x
video:0kB audio:2485kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.002829%

The -c:a option is the same as specifying -acodec; both of these specify the codec to encode audio streams with.

And finally a quick inspection with ffprobe (note ima4 on line 3):

$ ffprobe file.aiff
Input #0, aiff, from 'file.aiff':
  Duration: 00:00:54.31, start: 0.000000, bitrate: 374 kb/s
    Stream #0:0: Audio: adpcm_ima_qt (ima4 / 0x34616D69), 44100 Hz, 2 channels, s16p, 352 kb/s
9
  • I actually tried out ffmpeg but I was only searching for "Apple" and "AIFF", not "QuickTime" =D brb giving this a try!
    – xjcl
    Sep 18, 2018 at 23:04
  • Any way to set bit depth using this? The sample_fmt option with s16p doesn't work (bit rate stays 4, according to mediainfo)
    – xjcl
    Sep 18, 2018 at 23:45
  • 1
    From this reference page on the underlying codec: "The encoded IMA bitstream is comprised of a series of 4-bit nibbles." The bit depth appears to be hardcoded into the codec.
    – MTCoster
    Sep 19, 2018 at 14:27
  • So you are saying this is part of the specification and not just the implementation ffmpeg uses? How come my reference file has a bit depth of 16 then?
    – xjcl
    Sep 19, 2018 at 16:31
  • That's what it looks like to me. I'm not sure, is that what mediainfo is saying?
    – MTCoster
    Sep 19, 2018 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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