Mac OS X AAC command line encoder besides FAAC? |
![]() ![]() |
Mac OS X AAC command line encoder besides FAAC? |
Nov 18 2006, 03:35
Post
#1
|
|
|
Group: Members Posts: 16 Joined: 9-July 04 Member No.: 15190 |
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! |
|
|
|
Nov 18 2006, 09:04
Post
#2
|
|
![]() Group: Members Posts: 742 Joined: 27-May 02 From: Oslo, Norway Member No.: 2133 |
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) |
|
|
|
Nov 18 2006, 09:28
Post
#3
|
|
|
Group: Members Posts: 107 Joined: 10-October 05 Member No.: 25035 |
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.
|
|
|
|
Dec 19 2006, 20:47
Post
#4
|
|
|
Group: Members Posts: 16 Joined: 9-July 04 Member No.: 15190 |
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. |
|
|
|
May 24 2007, 18:54
Post
#5
|
|
|
Group: Members Posts: 2 Joined: 24-May 07 Member No.: 43740 |
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$ |
|
|
|
May 24 2007, 19:07
Post
#6
|
|
|
Group: Members Posts: 329 Joined: 30-September 05 From: London, Europe Member No.: 24805 |
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? This post has been edited by Maurits: May 24 2007, 19:11 |
|
|
|
May 24 2007, 19:47
Post
#7
|
|
|
Group: Members Posts: 2 Joined: 24-May 07 Member No.: 43740 |
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. |
|
|
|
May 30 2012, 14:46
Post
#8
|
|
|
Group: Members Posts: 11 Joined: 30-May 12 Member No.: 100283 |
On Windows/Linux I use ffmpeg/mencoder/mplayer for decoding, than sox for filtering and neroaacenc/qaac*/fhgaacenc*/flac/lame/oggenc/vo-aacenc(through ffmpeg) for encoding, since I want to do basically the same on mac I was wondering if anything has changed regarding aac command line encoders on mac since 2007?
faac and vo-aacenc(through ffmpeg) are command line encoders that support input via pipe, are there other alternatives on mac? @kcramer: did you create a modified version of afconvert which supports input via stdin? Cu Selur Ps.: sorry, for 'reviving' this old thread but it exactly fits to my problem,.. |
|
|
|
May 30 2012, 18:23
Post
#9
|
|
![]() A/V Moderator Group: Moderator Posts: 1668 Joined: 30-April 02 From: Slovenia Member No.: 1922 |
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. check my ffdrop http://forum.doom9.org/showthread.php?t=162621 , /audio section - curently it does not handle metadata - it works with tmp files - its highly adaptable (edit the bash script) -------------------- PANIC: CPU 1: Cache Error (unrecoverable - dcache data) Eframe = 0x90000000208cf3b8
NOTICE - cpu 0 didn't dump TLB, may be hung |
|
|
|
May 30 2012, 19:22
Post
#10
|
|
|
Group: Members Posts: 11 Joined: 30-May 12 Member No.: 100283 |
doesn't look like a command line tool,..
|
|
|
|
May 30 2012, 20:44
Post
#11
|
|
![]() A/V Moderator Group: Moderator Posts: 1668 Joined: 30-April 02 From: Slovenia Member No.: 1922 |
Its bunch of bash scripts that call command line tools (they come packed in droplets), but scripts could be easily adapted to run standalone,...
This post has been edited by smok3: May 30 2012, 20:45 -------------------- PANIC: CPU 1: Cache Error (unrecoverable - dcache data) Eframe = 0x90000000208cf3b8
NOTICE - cpu 0 didn't dump TLB, may be hung |
|
|
|
May 30 2012, 22:11
Post
#12
|
|
![]() Group: Members Posts: 392 Joined: 16-December 10 From: Palermo Member No.: 86562 |
Maybe XLD in batch mode is all you need.
-------------------- ... I live by long distance.
|
|
|
|
May 31 2012, 03:44
Post
#13
|
|
|
Group: Members Posts: 85 Joined: 16-November 11 Member No.: 95208 |
Couldn't the command line version of XLD do what you're after ?
|
|
|
|
May 31 2012, 06:51
Post
#14
|
|
|
Group: Members Posts: 11 Joined: 30-May 12 Member No.: 100283 |
I'll look into it, never heard of XLD before.
|
|
|
|
May 31 2012, 06:55
Post
#15
|
|
|
Group: Members Posts: 85 Joined: 16-November 11 Member No.: 95208 |
XLD is the holiy grail for OS X. http://tmkk.pv.land.to/xld/index_e.html
|
|
|
|
May 31 2012, 07:41
Post
#16
|
|
|
Group: Members Posts: 11 Joined: 30-May 12 Member No.: 100283 |
Is there some 'howto' with examples somewhere?
How to convert stuff that comes via stdin to aacl lc/he/hev2 with the command line xld? |
|
|
|
May 31 2012, 08:07
Post
#17
|
|
![]() Group: Members Posts: 392 Joined: 16-December 10 From: Palermo Member No.: 86562 |
Is there some 'howto' with examples somewhere? How to convert stuff that comes via stdin to aacl lc/he/hev2 with the command line xld? It's possible that you don't even need to use CLI at all: "batch mode" means that you set the encoding preferences and let XLD to do all the job to clone even a whole music library, scanning subfolders and transconding every track on the way, metadata included. Just File > Open the folder where you want to start. It's generally faster and more efficient than a shell script because it's possible to set the number of concurrent jobs to run, making better use of multicore CPUs. Here I have no Mac at hand, but it should be easy to figure our yourself just looking in the "batch" pane of preferences. -------------------- ... I live by long distance.
|
|
|
|
May 31 2012, 11:51
Post
#18
|
|
|
Group: Members Posts: 11 Joined: 30-May 12 Member No.: 100283 |
[qutoe]It's possible that you don't even need to use CLI at all[/quote]
BUT I want/need a command line tool not some gui,.. |
|
|
|
May 31 2012, 12:46
Post
#19
|
|
|
Group: Members Posts: 149 Joined: 20-September 11 Member No.: 93842 |
Even though I'm no Mac user, I'm quite certain that XLD can work as a command-line application and should be exactly what you're looking for.
|
|
|
|
May 31 2012, 13:08
Post
#20
|
|
![]() Group: Members Posts: 392 Joined: 16-December 10 From: Palermo Member No.: 86562 |
BUT I want/need a command line tool not some gui,.. So the way to obtain a result is more important than the result itself? Ok, you will have your reasons... I think this command line should solve your problem: CODE xld [-f format] [-o outpath] input_file -------------------- ... I live by long distance.
|
|
|
|
May 31 2012, 13:32
Post
#21
|
|
|
Group: Members Posts: 11 Joined: 30-May 12 Member No.: 100283 |
downloaded xld from (http://tmkk.pv.land.to/xld/index_e.html) but if I call xld it only mentions wav, aif, raw_big, raw_little as formats,..
calling xld with: CODE ./ffmpeg -y -threads 2 -v -10 -i "/Users/Selur/Desktop/tmp/test DELAY -43ms__aid_1__14_13_23_631_01.ac3" -ac 6 -acodec pcm_s16le -f wav - | ./xld -f aif -o "/Users/Selur/Desktop/tmp/test DELAY -43ms__aid_1__14_13_23_631_02.aac" - I just get: QUOTE Illegal instruction: 4 Cu Selur |
|
|
|
May 31 2012, 14:54
Post
#22
|
|
![]() Group: Members Posts: 392 Joined: 16-December 10 From: Palermo Member No.: 86562 |
CODE ./ffmpeg -y -threads 2 -v -10 -i "/Users/Selur/Desktop/tmp/test DELAY -43ms__aid_1__14_13_23_631_01.ac3" -ac 6 -acodec pcm_s16le -f wav - | ./xld -f aif -o "/Users/Selur/Desktop/tmp/test DELAY -43ms__aid_1__14_13_23_631_02.aac" - I just get: QUOTE Illegal instruction: 4 Not sure if XLD works with pipes. Try to do it in two stages (e.g. generating a temp file and then deleting it) to see if all other options work. -------------------- ... I live by long distance.
|
|
|
|
Jun 1 2012, 13:25
Post
#23
|
|
|
Group: Members Posts: 11 Joined: 30-May 12 Member No.: 100283 |
if it doesn't work with pipes it's not interesting for me,...
(sadly I haven't found any documentation about the -d parameter, regarding what options are possible,...) |
|
|
|
Jun 1 2012, 17:11
Post
#24
|
|
![]() Group: Members Posts: 392 Joined: 16-December 10 From: Palermo Member No.: 86562 |
if it doesn't work with pipes it's not interesting for me,... Have you made the temporary file test to verify? -------------------- ... I live by long distance.
|
|
|
|
Jun 1 2012, 19:57
Post
#25
|
|
|
Group: Members Posts: 11 Joined: 30-May 12 Member No.: 100283 |
yes. I also tried:
afconvert -f m4af sixChannel.wav test.aac and ended up with: Error: ExtAudioFileSetProperty ('cfmt') failed ('!dat') -> no clue what's the problem,.. |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 20th June 2013 - 03:40 |