IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Converting FLAC to iTunes AAC, How do I do it?
sarixe
post Jul 26 2009, 08:02
Post #1





Group: Members
Posts: 4
Joined: 26-July 09
Member No.: 71781



I'm ready to start using iTunes AAC as the codec of choice on my iPod. I have a rather large collection of FLAC, and need to be able to encode it all to iTunes AAC. I've been searching all evening for an effective solution, and I came very close with iTunesEncode.exe by Otto42. It's a great program, but, as I've read, it's been broken since iTunes 7.7. Indeed, I tried to batch encode some of the FLACs with it in foobar2000, and more than half of them threw terribly fatal errors. Needless to say, that's completely unacceptable.

Anyway, I was wondering, is there another script out there that does what iTunesEncode.exe did? I need it to either be command line (so I can batch encode with foobar2000) or have it able to batch encode by itself.

Also, if there's a standalone hack or something of the iTunes AAC codec, that would work.
Go to the top of the page
+Quote Post
lvqcl
post Jul 26 2009, 09:46
Post #2





Group: Developer
Posts: 3381
Joined: 2-December 07
Member No.: 49183



iTunes 8.0.2: works allright.

Maybe you have to set Thread count to 1.
(File -> Properties -> Advanced -> Tools -> Converter -> Thread count)
Go to the top of the page
+Quote Post
sarixe
post Jul 26 2009, 10:08
Post #3





Group: Members
Posts: 4
Joined: 26-July 09
Member No.: 71781



I had already tried that... and I even raised the value of the -s switch (which is how long it waits in between encoding files, to minimize errors) to 10000ms. That had no effect. It seems random as to whether a file will encode correctly or completely fail, and it's different every time. I am at a loss.

On a side note, I read that Snow Leopard got HE-AAC encoding. If that's true, then hopefully it'll be coming to iTunes soon, in which case I'd really like to get this working. iTunes seems to make use of some of the best codecs available, and hopefully it'll be the same story for HE-AAC.

Also, can someone tell me whether Quicktime Pro can handle large batch encodings of flac, or whether it can be used with a command line? I hear its AAC codec is the same codec used in iTunes, and if I could use that, it would be just as good.
Go to the top of the page
+Quote Post
antman
post Jul 26 2009, 13:47
Post #4





Group: Members
Posts: 103
Joined: 3-January 07
From: Texas
Member No.: 39241



QUOTE (sarixe @ Jul 26 2009, 04:08) *
iTunes seems to make use of some of the best codecs available


Whoa. Statements like that will get you shot around here.

One way to do this within iTunes is convert your FLACs to ALAC (using dBpoweramp) and then let iTunes transcode to AAC for you. Not a bad idea if you want to use iTunes exclusively.

FLAC to ALAC post

And iTunes does use Quicktime to transcode. You just can't get to all the encoder settings from within iTunes.

iTunes Plus preset reverse engineered
Go to the top of the page
+Quote Post
sarixe
post Jul 26 2009, 15:43
Post #5





Group: Members
Posts: 4
Joined: 26-July 09
Member No.: 71781



Eh... surely there must be a far less space-consuming method of doing this than converting everything to ALAC first. Is there some kind of dBpoweramp plugin that can make use of the iTunes encoding API, like iTunesEncode (sometimes) does? Also, is it possible, by any stretch of the imagination, to mount flac files as a CD, and then rip it from within iTunes? That would be incredibly interesting.
Go to the top of the page
+Quote Post
kothrush
post Jul 26 2009, 19:05
Post #6





Group: Members
Posts: 6
Joined: 13-April 06
Member No.: 29495



QUOTE (sarixe @ Jul 26 2009, 03:02) *
I'm ready to start using iTunes AAC as the codec of choice on my iPod. I have a rather large collection of FLAC, and need to be able to encode it all to iTunes AAC. I've been searching all evening for an effective solution, and I came very close with iTunesEncode.exe by Otto42. It's a great program, but, as I've read, it's been broken since iTunes 7.7. Indeed, I tried to batch encode some of the FLACs with it in foobar2000, and more than half of them threw terribly fatal errors. Needless to say, that's completely unacceptable.

Anyway, I was wondering, is there another script out there that does what iTunesEncode.exe did? I need it to either be command line (so I can batch encode with foobar2000) or have it able to batch encode by itself.

Also, if there's a standalone hack or something of the iTunes AAC codec, that would work.


Don't know if there is any app on windows which does batch conversion to aac (using quicktime engine), but if you have access to a mac then you can batch transcode almost any audio file formats using Max. http://sbooth.org/Max/
Go to the top of the page
+Quote Post
kornchild2002
post Jul 26 2009, 21:09
Post #7





Group: Members
Posts: 2078
Joined: 8-April 05
From: Cincinnati, OH
Member No.: 21277



There aren't very many solutions for iTunes AAC encoding on Windows. Your best option would be to convert your FLAC files to ALAC and then to iTunes AAC. This would be better in the long run if you plan on using iTunes for your lossy/lossless needs anyway. Mac OS X offers scripts and even software such as XLD and MAX that allow for FLAC to iTunes AAC encoding. However, Windows is pretty much limited to iTunes for iTunes AAC encoding.
Go to the top of the page
+Quote Post
Alexxander
post Jul 26 2009, 21:36
Post #8





Group: Members
Posts: 463
Joined: 15-November 04
Member No.: 18143



Why convert to ALAC? Doesn't iTunes support encoding of wav files? (I refuse to install iTunes happy.gif )

Edit: Thx kornchild2002, I forgot about the tags, it's late sleep.gif

This post has been edited by Alexxander: Jul 26 2009, 22:01
Go to the top of the page
+Quote Post
kornchild2002
post Jul 26 2009, 21:55
Post #9





Group: Members
Posts: 2078
Joined: 8-April 05
From: Cincinnati, OH
Member No.: 21277



Yes, iTunes can decode/encode WAV files just fine. However, when going from a FLAC collection to WAV files, the track tags will be lost. Converting to ALAC will preserve the track tags during the process. Additionally, ALAC files can be further converted using dBpowerAMP and even foobar2000 to other lossless/lossy formats. There really is no need to use WAV unless the OP is working with 24-bit content. Even then, dBpowerAMP is working on supporting 24-bit ALAC files in the near future.
Go to the top of the page
+Quote Post
/mnt
post Jul 26 2009, 23:11
Post #10





Group: Members
Posts: 697
Joined: 22-April 06
Member No.: 29877



Also coverting to WMA Lossless (i cannot belive i mentioned that) might work better, which has slightly better compat then ALAC . Since WMAL works on WMP, foobar2000 and can be transcoded into AAC through the iTunes first time use wizzard.

This post has been edited by /mnt: Jul 26 2009, 23:12


--------------------
"I never thought I'd see this much candy in one mission!"
Go to the top of the page
+Quote Post
Frumious B
post Jul 26 2009, 23:48
Post #11





Group: Members
Posts: 82
Joined: 14-March 09
From: Atlanta, GA
Member No.: 67956



QUOTE (sarixe @ Jul 26 2009, 03:02) *
I'm ready to start using iTunes AAC as the codec of choice on my iPod. I have a rather large collection of FLAC, and need to be able to encode it all to iTunes AAC. I've been searching all evening for an effective solution, and I came very close with iTunesEncode.exe by Otto42. It's a great program, but, as I've read, it's been broken since iTunes 7.7. Indeed, I tried to batch encode some of the FLACs with it in foobar2000, and more than half of them threw terribly fatal errors. Needless to say, that's completely unacceptable.

Anyway, I was wondering, is there another script out there that does what iTunesEncode.exe did? I need it to either be command line (so I can batch encode with foobar2000) or have it able to batch encode by itself.

Also, if there's a standalone hack or something of the iTunes AAC codec, that would work.


Unless you are absolutely 100% dead set on having iTunes AAC you will probably have an easier time converting to Nero AAC since you can very easily convert your FLAC files using dBPoweramp or Foobar without going around your nose to get to your elbow. Try a few of your faves in Nero. I'll wager you'll be quite happy with the sound.

This post has been edited by Frumious B: Jul 26 2009, 23:50
Go to the top of the page
+Quote Post
sarixe
post Jul 27 2009, 00:54
Post #12





Group: Members
Posts: 4
Joined: 26-July 09
Member No.: 71781



I found a way to mount entire albums of flac as CDs. The solution is a program called WinMount. It's not free, but it mounts CUE files as audio CDs, and has a 15 day trial. iTunes is then able to rip from that, which is excellent.
Go to the top of the page
+Quote Post
Tony T
post Jan 1 2010, 18:37
Post #13





Group: Members
Posts: 20
Joined: 29-December 09
Member No.: 76474



QUOTE (sarixe @ Jul 26 2009, 09:02) *
I'm ready to start using iTunes AAC as the codec of choice on my iPod. I have a rather large collection of FLAC, and need to be able to encode it all to iTunes AAC. I've been searching all evening for an effective solution, and I came very close with iTunesEncode.exe by Otto42. It's a great program, but, as I've read, it's been broken since iTunes 7.7. Indeed, I tried to batch encode some of the FLACs with it in foobar2000, and more than half of them threw terribly fatal errors. Needless to say, that's completely unacceptable.

Anyway, I was wondering, is there another script out there that does what iTunesEncode.exe did? I need it to either be command line (so I can batch encode with foobar2000) or have it able to batch encode by itself.

Also, if there's a standalone hack or something of the iTunes AAC codec, that would work.


iTunesEncode.exe still works (a/o iTunes 9.0.2)
The following Windows Batch file will copy the tags & artwork from FLAC to AAC.

I also have an AppleScript for Mac (If anyone is interested, let me know)

4dos batch file (may need to edit a bit if you use the Windows shell):

CODE
@echo off
echo Set iTunes to 128VBR...
pause
for %f in (*.flac) gosub ENCODE128
exit

:ENCODE128
"C:\Program Files\FLAC\metaflac" "%f" --export-picture-to=artwork.jpg --export-tags-to=temp.txt
for /F "tokens=1,2 delims==" %%i in (temp.txt) do set %%i="%%j"
"C:\Program Files\FLAC\flac" -d "%f"
if ERRORLEVEL 1 pause
"C:\Program Files\iTunesEncode\iTunesEncode" -d -a "%@replace[%=",,%artist%]" -t "%@replace[%=",,%title%]" -l "%@replace[%=",,%album%]" -y %@instr[0,4,%@replace[%=",,%date%]] -n %@replace[%=",,%tracknumber%] -g "%@replace[%=",,%genre%]" -c "%@replace[%=",,%comment%]" -r "%@path[%@full["%f"]]artwork.jpg" -i "%@replace[.flac,.wav,%f]" -o "%@replace[.flac,.m4a,%f]"
for /F "tokens=1,2 delims==" %%i in (temp.txt) do set %%i=
del artwork.jpg temp.txt "%@replace[.flac,.wav,%f]"
return
Go to the top of the page
+Quote Post
Tony T
post Jan 3 2010, 16:12
Post #14





Group: Members
Posts: 20
Joined: 29-December 09
Member No.: 76474



Here's a bash script for the Mac (calls are made to Applescript. To change the codex, change your settings in iTunes.)
Tags and Artwork are preserved.
Uses "find" to walk a directory tree and execute the script (can be adapted for only one directory, see comments in script)
For example, if the FLAC's you want to convert are in ~/FLAC and this script is in ~/Scripts, then in Terminal run:
find ~/FLAC -iname *.flac -exec ~/Scripts/FlacToACC.sh {} \;
and then all FLAC Files in the FLAC directory AND all directories below the FLAC directory will be converted
(I have a stand-alone Applescript also is anyone's interested)

CODE
#!/bin/bash
#
# Flac to AAC/m4a (or any codex supported in iTunes)
#
# Run the following find command to walk a file hierarchy and convert FLAC to AAC:
#   find <Directory> -iname *.flac -exec ~/Scripts/FlacToACC.sh {} \;
#

if [ "$1" = "" ]; then
    echo "Flac to AAC/m4a (or any codex supported in iTunes)"
    echo "Run the following find command to walk a file hierarchy and convert FLAC to AAC:"
    echo "find <Directory> -iname *.flac -exec FlacToACC.sh {} \;"
    exit
else
#
# to process only a directory, comment out the previous ' if statement ' and ' f="$1" ' below
#   and change the last line in script from 'fi to ' done '  
#
#for f in ~/Downloads/*.flac
#do
#
f="$1"
    if  [ -e "$f" -a "${f##*.}" = "flac" -o "${f##*.}" = "FLAC" ]; then
        /usr/local/bin/metaflac --export-tags-to="$TMPDIR"flactags.txt \
        --export-picture-to="$TMPDIR"artwork.png "$f"
        while read i
            do
                case "${i%%=*}" in
                    TITLE)
                        TITLE="${i#*=}";;
                    ARTIST)
                        ARTIST="${i#*=}";;
                    ALBUM)
                        ALBUM="${i#*=}";;
                    DATE)
                        DATE="${i#*=}";;
                    GENRE)
                        GENRE="${i#*=}";;
                    COMMENT)
                        COMMENT="${i#*=}";;
                    TRACKNUMBER)
                        TRACKNUMBER="${i#*=}";;
                    TRACKTOTAL)
                        TRACKTOTAL="${i#*=}";;
                esac
            done < "$TMPDIR"flactags.txt
        if [ -e "$TMPDIR"artwork.png ]; then
            ARTWORKEXISTS=Yes
        else
            ARTWORKEXISTS=No
        fi
        ORIGDIR="${f%/*}"
        FLACNAME="${f##*/}"
        M4ANAME="${FLACNAME%.*}".m4a
        WAVFILE=$"$TMPDIR""${FLACNAME%.*}".WAV
        /usr/local/bin/flac -d --output-name="$WAVFILE" "$f"
        echo -e "\nConverting ${FLACNAME%.*}.wav\nArtist:\t\t$ARTIST"
        echo -e "Album:\t\t$ALBUM\nTitle:\t\t$TITLE"
        echo -e "Track:\t\t$TRACKNUMBER\nDate:\t\t$DATE"
        echo -e "Genre:\t\t$GENRE\nAlbum Art:\t$ARTWORKEXISTS"
        echo -e "Comment:\t$COMMENT"
# +Start Applescript+
osascript <<-HereDoc
        if "$ARTWORKEXISTS" is equal to "Yes" then
                tell application "Image Events"
                launch
                set the_image to open ("$TMPDIR" & "artwork.png")
                save the_image as PICT in ("$TMPDIR" & "artwork.pict")
                close the_image
            end tell
            set FlacArtwork to read ("$TMPDIR" & "artwork.pict") from 513 as picture
        end if
        tell application "iTunes"
            set newTrack to first item of (convert POSIX file "$WAVFILE")
            set name of newTrack to "$TITLE"
            set artist of newTrack to "$ARTIST"
            set album of newTrack to "$ALBUM"
            set year of newTrack to "$DATE"
            set genre of newTrack to "$GENRE"
            set comment of newTrack to "$COMMENT"
            set track number of newTrack to "$TRACKNUMBER"
            set track count of newTrack to "$TRACKTOTAL"
            if "$ARTWORKEXISTS" is equal to "Yes" then
                try
                    set data of artwork 1 of newTrack to FlacArtwork
                end try
            end if
            set newFile to (get location of newTrack) as text
            delete newTrack
        end tell
# NOTE: File is moved to the directory of the FLAC file processed.
#        Edit if m4a needs to be moved to a different directory
#        or comment line if file is to remain in iTunes
#        (and comment "delete newTrack" 2 lines above)
    
        do shell script "mv " & (quoted form of POSIX path of newFile) & " " & quoted form of ("$ORIGDIR" & "/" & "$M4ANAME")
HereDoc
# -End Applescript-
# Cleanup:
        rm "$WAVFILE" "$TMPDIR"artwork.pict "$TMPDIR"artwork.png "$TMPDIR"flactags.txt
    fi
#done
fi


This post has been edited by Tony T: Jan 3 2010, 16:35
Go to the top of the page
+Quote Post
iggyst00ge
post Jun 21 2010, 19:53
Post #15





Group: Members
Posts: 3
Joined: 23-March 07
From: Indianapolis, IN
Member No.: 41788



QUOTE (sarixe @ Jul 26 2009, 02:02) *
I'm ready to start using iTunes AAC as the codec of choice on my iPod. I have a rather large collection of FLAC, and need to be able to encode it all to iTunes AAC. I've been searching all evening for an effective solution, and I came very close with iTunesEncode.exe by Otto42. It's a great program, but, as I've read, it's been broken since iTunes 7.7. Indeed, I tried to batch encode some of the FLACs with it in foobar2000, and more than half of them threw terribly fatal errors. Needless to say, that's completely unacceptable.

Anyway, I was wondering, is there another script out there that does what iTunesEncode.exe did? I need it to either be command line (so I can batch encode with foobar2000) or have it able to batch encode by itself.

Also, if there's a standalone hack or something of the iTunes AAC codec, that would work.


I've had great luck with SoundKonverter (http://kde-apps.org/content/show.php?content=29024) on Linux (which will go from .flac to .aac). It's basically a front end for a bunch of encoders.

Not terribly fast, but it does batch jobs on a recursive directory search (critical when each album is in a different directory), it preserved my tags, and wrote the results to my custom file and directory structure (which works as a backup if my tags are wiped out during the process).

Been pleasantly surprised with the Linux tools available for working with music files.

Chris

Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 17th September 2014 - 15:32