Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: iTunes Encode and foobar2000 (Read 30767 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

iTunes Encode and foobar2000

Hello!

I am not sure if this should go to AAC or foobar2000, so sorry if I made the wrong decision.

Anyways, I am trying to convert some of my WavPack disc images to AAC tracks for use in an iPod. Since I don't want to decode the files to WAV with foobar2000, then import them in iTunes, have it encode one album, then switch to MP3Tag to add tags and change the filenames, I would like to do the whole conversion in one step using foobar2000 and the promising-looking iTunes Encode. However, although following the instructions from the readme and setting the bit-depth to 16 bits in fb2k as recommended by several users, foobar2000 always fails with the message that file XYZ could not be flushed. iTunes seems to receive only one file, while fb2k is sending two. Any idea how to solve the problem?

Regards,
Sebastian

Edit: I am using foobar2000 0.9 Beta 13.

iTunes Encode and foobar2000

Reply #1
I've been using iTunesEncode and Foobar 0.9 b13 to convert WavPack+Cue images for a while, I've had no problems. All I do is set up iTunesEncode like the Readme file says to do with Foobar, the resulting AAC files are tagged with iTunes and named like specified in the Converter settings. I don't remember if I set it to 16bit or 24bit, I think I had it set to 24 (there's currently nothing installed on my PC so I can't look, sorry).

EDIT: Maybe you set it up for piping instead of a temp file, maybe that's the problem.
we was young an' full of beans

 

iTunes Encode and foobar2000

Reply #2
Quote
I've been using iTunesEncode and Foobar 0.9 b13 to convert WavPack+Cue images for a while, I've had no problems. All I do is set up iTunesEncode like the Readme file says to do with Foobar, the resulting AAC files are tagged with iTunes and named like specified in the Converter settings. I don't remember if I set it to 16bit or 24bit, I think I had it set to 24 (there's currently nothing installed on my PC so I can't look, sorry).

EDIT: Maybe you set it up for piping instead of a temp file, maybe that's the problem.
[a href="index.php?act=findpost&pid=357393"][{POST_SNAPBACK}][/a]


Well, this is what I have:

Encoder: Custom
Encoder: C:\WINDOWS\iTunesEncode.exe
Extension: m4a
Parameters: -e "AAC Encoder" -a "%artist%" -l "%album%" -t "%title%" -g "%genre%" -y %date% -n %tracknumber% -i %s -o %d
Format is: lossy
Highest BPM mode supported: 16
Display name: M4A (iTunes), ~128kbps

When selecting a bunch of files and telling fb2k to convert into same directory with [%track% ]$if2(%title%,%filename%) as naming scheme, I get this error:

Quote
Error flushing file (Object Not Found) : file://D:\Eigene Musik\Hohe Qualität\Chris Rea\Espresso Logic\02 Red.m4a


As I said, fb2k is always processing two files at a time (maybe because I have two logical CPUs?).

iTunes Encode and foobar2000

Reply #3
Maybe if you try a different output filename and/or have iTunesEncode.exe in another directory, I keep it in Foobar's directory. Your parameters seem fine tho.
we was young an' full of beans

iTunes Encode and foobar2000

Reply #4
Try converting something else, such as a wav or flac file, with those parameters and see if it works.  That should help narrow the problem.

iTunes Encode and foobar2000

Reply #5
Try:

-e "AAC Encoder" -a "%artist%" -l "%album%" -t "%title%" -g "%genre%" -y %date% -n %tracknumber% -d -i %s -o %d

(-d deletes the encoded tracks from the iTunes library. I got a similar problem with iTunesEncode before using this switch. Don't ask me why...)

iTunes Encode and foobar2000

Reply #6
Quote
As I said, fb2k is always processing two files at a time (maybe because I have two logical CPUs?).
According to this thread foobar 0.9 has done this since beta 10.

I can only assume that iTunes cannot handle being told to encode two files at a time.

It would be a shame if you cannot work around this on a dual processor machine.

Edit: Could you try with 0.8.3?
I'm on a horse.

iTunes Encode and foobar2000

Reply #7
I can't get it working.

With foobar 0.9 b12 I get the same error message as Sebastian. foobar 0.83 hangs in the first "converting" display and the foobar task must be killed.

This happens with various source file formats. "-d" does not help anything. I have the P4 Hyperthreading enabled (uses two virtual processors).

This used to work with some older iTunes version several months ago. I guess iTunes has changed since then (I have v. 6.0.1.3 now). On the other hand the iTunes module in dBpowerAMP works.

iTunes Encode and foobar2000

Reply #8
I have 6.0.1.3, and a machine with 1 processor.

It works fine using Otto's suggested fb2k command line with foobarr 0.9b13.
I'm on a horse.

iTunes Encode and foobar2000

Reply #9
I had the same problem with Hyperthreading, and in the end, I had to turn hyperthreading off.

Just a thought: it might be possible to restrict it to only 1 instance using processor affinity. I have not tried though.

iTunes Encode and foobar2000

Reply #10
Quote
This used to work with some older iTunes version several months ago. I guess iTunes has changed since then (I have v. 6.0.1.3 now). On the other hand the iTunes module in dBpowerAMP works.

Is it possible that you were also using a version of foobar 0.9 pre beta 10?

I.e.: It may not be the change in iTunes, but more likely the change in foobar that has stopped it working.

Edit: Although this doesn't explain why you have problems with 0.8.3... 
I'm on a horse.


iTunes Encode and foobar2000

Reply #12
Quote
Quote
This used to work with some older iTunes version several months ago. I guess iTunes has changed since then (I have v. 6.0.1.3 now). On the other hand the iTunes module in dBpowerAMP works.

Is it possible that you were also using a version of foobar 0.9 pre beta 10?

I.e.: It may not be the change in iTunes, but more likely the change in foobar that has stopped it working.

Edit: Although this doesn't explain why you have problems with 0.8.3... 
[{POST_SNAPBACK}][/a]

[a href="http://www.dbpoweramp.com/codec-central-mp4.htm]http://www.dbpoweramp.com/codec-central-mp4.htm[/url]

iTunes Encode and foobar2000

Reply #13
Quote
I can only assume that iTunes cannot handle being told to encode two files at a time.

I can confirm this. iTunesEncode will report failure if you try to run two instances of it simultaneously. This is a limitation of iTunes, I cannot work around it.

Quote
It would be a shame if you cannot work around this on a dual processor machine.
[a href="index.php?act=findpost&pid=357746"][{POST_SNAPBACK}][/a]

Set foobar's processor affinity to one CPU only so that it won't try to launch two encoding processes.

iTunes Encode and foobar2000

Reply #14
Quote
Set foobar's processor affinity to one CPU only so that it won't try to launch two encoding processes.

This (Otto's) thread looks useful, if this is a more suitable resolve.

I only wish I could afford to have two processors.

Edit:  Not sure if this is of any further use.
I'm on a horse.

iTunes Encode and foobar2000

Reply #15
Quote
Set foobar's processor affinity to one CPU only so that it won't try to launch two encoding processes.
[a href="index.php?act=findpost&pid=357820"][{POST_SNAPBACK}][/a]


I tried to set the affinity to CPU 0, but it doesn't work. foobar2000 keeps converting two files at a time.

BTW, I don't have two physical CPUs / cores, but an Intel Pentium with HT that "simulates" two processors.

iTunes Encode and foobar2000

Reply #16
Quote
Quote
Set foobar's processor affinity to one CPU only so that it won't try to launch two encoding processes.
[a href="index.php?act=findpost&pid=357820"][{POST_SNAPBACK}][/a]


I tried to set the affinity to CPU 0, but it doesn't work. foobar2000 keeps converting two files at a time.

BTW, I don't have two physical CPUs / cores, but an Intel Pentium with HT that "simulates" two processors.[a href="index.php?act=findpost&pid=357831"][{POST_SNAPBACK}][/a]

That is because foobar2000 does not query the number of processors it may run on, but the number of installed processors.

iTunes Encode and foobar2000

Reply #17
Quote
That is because foobar2000 does not query the number of processors it may run on, but the number of installed processors.
[a href="index.php?act=findpost&pid=357834"][{POST_SNAPBACK}][/a]

Well, then that is a bug. If I've restricted a program to run on one processor only and it intentionally tries to run on more than one, then it has done something I have explicitly told it not to do. I grant you that this is an edge case, since foobar is actually launching other processes. However, there are cases where you cannot rely on the number of "installed" processors either, such as having two dual-core processors (Windows reports this as three installed processors, though it allows use of all four, I think).

Really, the simplest solution seems to be to put in a manual override somewhere in foobar's options. Maybe you want it to only launch one process for other reasons. Maybe you have some encoder that farms out the processing to other machines on a network, and so you can launch a dozen different processes to talk to those machines. Lots of possibles there, relying on the OS to give this sort of setting seems unwarranted.

iTunes Encode and foobar2000

Reply #18
How might this affect a Core Duo system?  Will it essentially act as a dual processor system, or one?

Anyone tried it?


iTunes Encode and foobar2000

Reply #20
Quote
I am almost sure 2. And if you have a dual core system with HT, most likely 4.
[a href="index.php?act=findpost&pid=370017"][{POST_SNAPBACK}][/a]



Ah, ok.  So, was this a bug in iTunesEncode, or fb2k?

Edit:  from what I am seeing, I'm thinking it's a bug in fb2k, as far as the affinity specification goes.  Otherwise, it's a bug in iTunes itself, right?  You'd think they'd iron this out, especially with macbook pros being dual core...


iTunes Encode and foobar2000

Reply #22
Quote
How might this affect a Core Duo system?  Will it essentially act as a dual processor system, or one?

Anyone tried it?
[a href="index.php?act=findpost&pid=370016"][{POST_SNAPBACK}][/a]

I have an AMD Dual Core chip, and yeah, it'll try to launch two processes. I expect the Core Duo will be the same.

Welcome to the sometimes painful world of multiple processors. I've found numerous programs that have problems with my dual core setup. Forcing affinity usually fixes the problem though. You find this problem in the weirdest places too.. Like IrfanView. You wouldn't expect an image viewing/editing program to be thread unsafe, would you? Well, it is, somehow.

Anyway, iTunes no longer has the original dual core problems I posted about in another thread (they fixed it in 6.02 or 6.03, I think) , but iTunesEncode in combination with iTunes cannot cope with dual cores and two iTunesEncode instances. This has to do with iTunes encoding mechanism, it cannot add encoding processes after the fact, as it were... You can demonstrate this in iTunes by telling it to "Convert" some file, then telling it to convert another file. It'll complain about that. But if you select multiple files and tell it to convert them all at once, it's okay with that.

iTunesEncode is geared to only encode a single file, not multiple files, and so it runs afoul of this restriction in iTunes when you run it twice. A future revision of iTunes might remove this limitation, but I would not expect it to happen anytime soon. And given the available COM interface in iTunes, there's no obvious way for me to tell iTunes to encode multiple files simultaneously from an external program.

So the short of it is that foobar needs to recognize the number of available processors (instead of the number of installed processors), or to have an override to allow you to specify the number of encoding processes. Either way would let you solve the problem, either by setting affinity or by overriding the spawned encoders to 1 only.

Note that it might be possible to rejigger iTunesEncode to detect this condition and wait for iTunes to become available for encoding again. This would effectively force one instance to wait for the other to quit before it started encoding. However, since I lost a lot of iTunesEncode's source by accident, I'd have to rewrite most of iTunesEncode in order to do it.

iTunes Encode and foobar2000

Reply #23
Quote
Note that it might be possible to rejigger iTunesEncode to detect this condition and wait for iTunes to become available for encoding again. This would effectively force one instance to wait for the other to quit before it started encoding. However, since I lost a lot of iTunesEncode's source by accident, I'd have to rewrite most of iTunesEncode in order to do it.
[a href="index.php?act=findpost&pid=370230"][{POST_SNAPBACK}][/a]



Shoot, if you have time at some point, that would be greatly appreciated. 

How long did it take you to write iTunesEncode?

iTunes Encode and foobar2000

Reply #24
I have hyperthreading processor and for me it would be nice to have way to force foobar2000 to use only x threads while encoding.  So it could do encoding "on background" while other programs have still own "cpu" to use.

There is quite big overall performance hit for userprograms when cpu-intensive program uses both "cpus".