AAC encoding error

Discuss the current and future development of Max.
Post Reply
Maurits
Posts: 117
Joined: Sun Jan 29, 2006 1:36 pm
Location: London, Europe

AAC encoding error

Post by Maurits » Thu Nov 02, 2006 12:48 pm

Even in build 1042 I still get the following error after ripping to AAC:
An error occurred while tagging the file "xxxx.m4a".

Unable to optimize the file"xxxx.m4a".
Files are fine, can play and have metadata. The atoms are still in the wrong order though so no optimization has indeed occurred so they won't play on iPod Shuffle or streamed through iTunes/Airfoil.

Any ideas what causes this? Am I doing something wrong?

User avatar
sbooth
Site Admin
Posts: 2445
Joined: Fri Dec 23, 2005 7:45 am
Location: USA
Contact:

Post by sbooth » Thu Nov 02, 2006 2:40 pm

Are the temporary directory and output directory on two different devices or filesystems? I think the problem might be that rename() can't handle file system boundaries.

Maurits
Posts: 117
Joined: Sun Jan 29, 2006 1:36 pm
Location: London, Europe

Post by Maurits » Thu Nov 02, 2006 3:19 pm

Yes, I think you're on to something.

I had set the output dir to /Volumes/Data/%username%/Music and left the temp dir at 'default'. If I set 'temp' to the same dir as 'output' it works. If I set it to a dir on /Volumes/System/ it doesn't.

I'm not quite sure what happens and still testing, could you tell me what's the 'default' 'temp' dir?

It could be that 'temp' was on the other volume by default and it can't handle the different volumes, like you say.

Sokoban
Posts: 6
Joined: Wed Aug 23, 2006 10:48 pm

Post by Sokoban » Thu Nov 02, 2006 9:17 pm

I was having the exact same problem. I keep my system files and applications on one drive and all my media files on another. Putting the temp file on the same drive as the directory for the created files helps to suppress the error messages about optimizing, but I still get the problem with the unknown bitrate and playing over a network and such. I am not ripping files however, I am converting FLACs

User avatar
sbooth
Site Admin
Posts: 2445
Joined: Fri Dec 23, 2005 7:45 am
Location: USA
Contact:

Post by sbooth » Thu Nov 02, 2006 10:04 pm

Maurits wrote:I had set the output dir to /Volumes/Data/%username%/Music and left the temp dir at 'default'. If I set 'temp' to the same dir as 'output' it works. If I set it to a dir on /Volumes/System/ it doesn't.

I'm not quite sure what happens and still testing, could you tell me what's the 'default' 'temp' dir?

It could be that 'temp' was on the other volume by default and it can't handle the different volumes, like you say.
The default temporary directory is whatever NSTemporaryDirectory() returns- for me it a subdirectory of /var/tmp/.

Maurits
Posts: 117
Joined: Sun Jan 29, 2006 1:36 pm
Location: London, Europe

Post by Maurits » Thu Nov 02, 2006 11:11 pm

OK, this is odd. I set the 'temp' dir to the Volume I knew it would fail on and it did fail. However, there is a complete and neatly optimized file left in the 'temp' location, even though Max says it couldn't optimize. This file in the 'temp' location is optimized and plays fine while the official file at the 'output' location remains unoptimized.

It appears all goes well, apart from the moving of the optimized file from the 'temp' to the 'output' dir to overwrite the unoptimized one. Only the very last stage fails.

Is this enough info for you to work with?

User avatar
sbooth
Site Admin
Posts: 2445
Joined: Fri Dec 23, 2005 7:45 am
Location: USA
Contact:

Post by sbooth » Fri Nov 03, 2006 12:02 am

Maurits wrote:It appears all goes well, apart from the moving of the optimized file from the 'temp' to the 'output' dir to overwrite the unoptimized one. Only the very last stage fails.

Is this enough info for you to work with?
This is helpful- I've just committed a patch that I think should solve the problem. I am uploading svn revision 1043 to the website for testing at your leisure...

Maurits
Posts: 117
Joined: Sun Jan 29, 2006 1:36 pm
Location: London, Europe

Post by Maurits » Fri Nov 03, 2006 12:35 am

Sir, you may be pleased to hear it all seems to work now.

I tried some very obscure 'temp' locations including 'default' and it all seems to work. Files are neatly optimized as well. Thanks! 8)


Now rests the nice task of cleaning all the previous temp dirs I chose during testing in the previous build, they are all filled with the tempfiles which couldn't be copied so were just left there. :D

Maurits
Posts: 117
Joined: Sun Jan 29, 2006 1:36 pm
Location: London, Europe

Post by Maurits » Fri Nov 03, 2006 12:39 am

By the way, Sokoban, try it again with this new build. The problems you have are very likely to be caused by optimization not working. Since that seems to work fine now, your problems may very well be gone.

Sokoban
Posts: 6
Joined: Wed Aug 23, 2006 10:48 pm

Post by Sokoban » Sat Nov 04, 2006 6:27 am

Yeah, I'm still having the Apple Lossless Unknown bitrate problem. Honestly, I'm not that worried about it though. Max is still the best FLAC decoder on OS X.

Maurits
Posts: 117
Joined: Sun Jan 29, 2006 1:36 pm
Location: London, Europe

Post by Maurits » Fri Nov 24, 2006 12:55 am

Regarding the regression of this optimization error, I've noticed it doesn't appear to create the temp file at all. No issues with copying it this time and therefore no corresponding error warnings. Watching the temp folder shows no sign of a temp file being created and even setting temp-dir to a read-only dir doesn't give an error.

It seems more likely the whole optimization process is not executed.


Edit: gotcha! :)
Converting Wav->m4a: not optimized
Converting Mp3->m4a: optimized

The fact that Wav caries no metadata to fill the m4a's metadata is possibly crashing/confusing/skipping the tagging and thereby the optimization process. Now itunSMPB is written to the otherwise empty moov atom even these cases need optimization.
Last edited by Maurits on Fri Nov 24, 2006 11:29 am, edited 1 time in total.

User avatar
sbooth
Site Admin
Posts: 2445
Joined: Fri Dec 23, 2005 7:45 am
Location: USA
Contact:

Post by sbooth » Fri Nov 24, 2006 5:00 am

Nice catch! I will commit a fix and post here when it's done.

Maurits
Posts: 117
Joined: Sun Jan 29, 2006 1:36 pm
Location: London, Europe

Post by Maurits » Thu Nov 30, 2006 2:20 pm

I've been thinking, fixing this issue might be easier with metadata, and even if it isn't it may still be worth considering:
Store the filename (minus the extension) of the original file lacking metadata in the Title field of the output file.

Pros:

* Filename is usually the only source of info about the track when there is no previous metadata
* The field would be empty otherwise, no data is lost, only added
* Files can be distinguished easier when opened afterwards in mass taggers, iTunes, Cog, Play etc.
* Mass taggers can use the data in the field for automated tag filling
* Unlike the Artist or Album field no extra dir in the iTunes library will be created when files with just a Title field are imported
* All files, regardless of their source, will have metadata, this could possibly make the tagging code easier

Cons:

* Filename is strictly speaking not the same as the Title (although neither is blank space)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest