Help - Search - Members - Calendar
Full Version: Mac OS X AAC command line encoder besides FAAC?
Hydrogenaudio Forums > Lossy Audio Compression > AAC > AAC - General
kcramer
Has anyone found a command line AAC encoder that will use QuickTime/iTunes to encode files?

I want to automate converting all my FLAC files to AAC (m4a) and I can do it with FAAC but I would prefer the quality of the QT/iTunes encoder. It seems like it wouldn't be hard for someone to write a small command line application that uses the CoreAudio API to do this work.

Has anyone seen such a tool? I've had no luck finding one.

Thanks!
krmathis
What about 'afconvert'? A CoreAudio example application, following Xcode Tools.
QUOTE
afconvert - reads one audio file, writes it to another format. Good example of the power of CAAudioFile and use of the AudioConverter for codecs.


CODE
$ afconvert
Usage:
afconvert [option...] input_file [output_file]

Options: (may appear before or after arguments)
    { -f | --file } file_format:
        'adts' = AAC ADTS (.aac, .adts)
                   data_formats: 'aac '
        'ac-3' = AC3 (.ac3)
                   data_formats: 'ac-3'
        'AIFC' = AIFC (.aif, .aiff, .aifc)
                   data_formats: BEI8 BEI16 BEI24 BEI32 BEF32
                                 BEF64 'ulaw' 'alaw' 'MAC3' 'MAC6' 'ima4'
                                 'QDMC' 'QDM2' 'Qclp' 'agsm'
        'AIFF' = AIFF (.aif, .aiff)
                   data_formats: BEI8 BEI16 BEI24 BEI32
        'caff' = Apple CAF File (.caf)
                   data_formats: '.mp3' 'MAC3' 'MAC6' 'QDM2' 'QDMC'
                                 'Qclp' 'Qclq' 'TS\x00\x02' 'TS\x00\x06' 'TS\x00\x07' 'TS\x00\x11'
                                 'TS\x00E' 'TS\x00U' 'WMA1' 'WMA2' 'WMA3' 'aac '
                                 'agsm' 'alac' 'alaw' 'drms' 'dvca' 'dvi '
                                 'ima4' 'lpc ' BEI8 BEI16 BEI24 BEI32
                                 BEF32 BEF64 LEI16 LEI24 LEI32 LEF32
                                 LEF64 'ms\x00\x02' 'ms\x00\x11' 'ms\x001' 'ms\x00U' 'samr'
                                 'ulaw' 'vdva'
        'MPG3' = MPEG Layer 3 (.mp3, .mpeg)
                   data_formats: '.mp3'
        'mp4f' = MPEG4 Audio (.mp4)
                   data_formats: 'aac '
        'm4af' = MPEG4 Audio (.m4a)
                   data_formats: 'aac ' 'alac'
        'NeXT' = NeXT/Sun (.snd, .au)
                   data_formats: BEI8 BEI16 BEI24 BEI32 BEF32
                                 BEF64 'ulaw'
        'Sd2f' = Sound Designer II (.sd2)
                   data_formats: BEI8 BEI16 BEI24 BEI32
        'WAVE' = WAVE (.wav)
                   data_formats: LEUI8 LEI16 LEI24 LEI32 LEF32
                                 LEF64 'ulaw' 'alaw'
    { -d | --data } data_format[@sample_rate_hz][/format_flags][#frames_per_packet] :
        [-][BE|LE]{F|[U]I}{8|16|24|32|64}          (PCM)
            e.g.   BEI16   F32@44100
        or a data format appropriate to file format, as above
        format_flags: hex digits, e.g. '80'
        bitdepth on non-PCM formats can be specified, e.g.: alac-24
        Frames per packet can be specified for some encoders, e.g.: samr#12
    { -c | --channels } number_of_channels
        add/remove channels without regard to order
    { -l | --channellayout } layout_tag
        layout_tag: name of a constant from CoreAudioTypes.h
          (prefix "kAudioChannelLayoutTag_" may be omitted)
        if specified once, applies to output file; if twice, the first
          applies to the input file, the second to the output file
    { -b | --bitrate } bit_rate_bps
         e.g. 128000
    { -q | --quality } codec_quality
        codec_quality: 0-127
    { -r | --src-quality } src_quality
        src_quality (sample rate converter quality): 0-127
    { -v | --verbose }
        print progress verbosely
    { -s | --strategy } strategy
        bitrate strategy for encoded file
        0 for CBR, 1 for ABR, 2 for VBR
    { -t | --tag }
        If encoding to CAF, store the source file's format and name in a user chunk.
        If decoding from CAF, use the destination format and filename found in a user chunk.
    --prime-method method
        decode priming method (see AudioConverter.h)
dbAmp
This sounds like it is something that could be done with an AppleScript. If one already exists, it's probably at Doug's AppleScripts for iTunes.
kcramer
afconvert looks very good. I may have to change the application so it can read from stdin though. My conversion process relies on chaining applications together.

I guess I missed that when browsing the XCode stuff.

Thanks for all the suggestions.
nerd
QUOTE(kcramer @ Dec 19 2006, 13:47) *

afconvert looks very good. I may have to change the application so it can read from stdin though. My conversion process relies on chaining applications together.

I guess I missed that when browsing the XCode stuff.

Thanks for all the suggestions.


I'm looking for a mp3 to aac converter. I compiled afconvert, but I get a "Couldn't set file's length (-66566)" error.

here is the command I try. (i've also tried several others)
~/afconvert -v -f "mp4f" -d "aac " she_waits_mix.wav.mp3 test.mp4

and here is the output...
Input file: she_waits_mix.wav.mp3, 6276096 frames
Formats:
Input file 2 ch, 44100 Hz, '.mp3' (0x00000000) 0 bits/channel, 0 bytes/packet, 1152 frames/packet, 0 bytes/frame
Output file 2 ch, 44100 Hz, 'aac ' (0x00000002) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame
Stereo
Input client 2 ch, 44100 Hz, 'lpcm' (0x00000009) 32-bit little-endian float
AudioConverter 0x180ce84 [0x319cc0]:
CodecConverter 0x319ec0
Input: 2 ch, 44100 Hz, '.mp3' (0x00000000) 0 bits/channel, 0 bytes/packet, 1152 frames/packet, 0 bytes/frame
Output: 2 ch, 44100 Hz, 'lpcm' (0x00000009) 32-bit little-endian float
Output client 2 ch, 44100 Hz, 'lpcm' (0x00000009) 32-bit little-endian float
AudioConverter 0x180ce8c [0x31a0c0]:
CodecConverter 0x31a2e0
Input: 2 ch, 44100 Hz, 'lpcm' (0x00000009) 32-bit little-endian float
Output: 2 ch, 44100 Hz, 'aac ' (0x00000002) 0 bits/channel, 0 bytes/packet, 1024 frames/packet, 0 bytes/frame
error -66566: Couldn't set file's length

Error: Couldn't set file's length (-66566)

it looks like it's working, but it just can't write the file?



I have also tried running faac, and it looks like it can't open the orginal mp3 file.. but it's a fine mp3. I can play it with all the mp3 players. (I encoded it using lame)

coca:~/music_projects nerd$ faac she_waits_mix.wav.mp3 -o test.mp4a
Freeware Advanced Audio Coder
FAAC 1.25

Couldn't open input file she_waits_mix.wav.mp3
coca:~/music_projects nerd$
Maurits
Isn't this something you can let Max handle? It can transcode straight from MP3 to AAC using the CoreAudio/iTunes/QuickTime encoder.

By the way, you are aware that lossy-to-lossy transcoding is considered bad for audio quality?
nerd
QUOTE(Maurits @ May 24 2007, 12:07) *

Isn't this something you can let Max handle? It can transcode straight from MP3 to AAC using the CoreAudio/iTunes/QuickTime encoder.

By the way, you are aware that lossy-to-lossy transcoding is considered bad for audio quality?


Thanks, Maurtis. I tried it out and it works for making a mp4. But I need to automate the process, that's one reason I wanted to use s command line app. Is there a way to automate with Max? if so It doesn't seem obvious.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.