0

I do audio processing on Debian Linux, and find that a virtual machine with only one core encodes audio as OGG or AAC just about as fast with eight CPU cores.

Since I lack systematic computer science education, I missed the part about allotting CPU resources, and what I’ve tried so far in Linux seems to be a dead end, so I’ll spare you.

In short, is there a way I can launch an encoder, like fdkaac (non-free) or oggenc so that it will use as much CPU as the system has available?

3
  • You may want to take a look at Realtime kernel if you're only into audio processing. If it doesn't suit you, you can still change the priority level of a process using nice. Levels lower (meaning higher priority) than 0 (usually the default) will require root privileges or a specific configuration.
    – piernov
    Commented Aug 20, 2016 at 21:40
  • It's likely your program is running in a single thread/process of execution which means it will only ever be able to use a single core. You may want to look for alternative programs or see if the program has a setting to enable use of multiple cores/processes/threads of execution. See stackoverflow.com/questions/35188526/…
    – nijave
    Commented Aug 20, 2016 at 21:59
  • "Sounds like difference in single- vs multi-thread" and thanks, it sounds like the other question was asked by someone w. 8 cores to use! I'll do Thanks, nijave I'll get some stats comparing ffpeg w. fdkaac - but first intend to check that I'll get the same quality as using fdkaac alone. Going to a real time kernel is one of those complexities I intentionally didn't mention, but it does seem to make sense.
    – Realo
    Commented Aug 20, 2016 at 22:29

1 Answer 1

2

In order to benefit from several CPU cores, the encoder program you're using should be written in a special way (with threads). This is not the case for oggenc. You can try to use encoders which support threads, like mencoder. mencoder has a threads parameter which you should set to 8 (its default value is 1, meaning no threads).

Another possibility (which is often preferred) is to encode several files at the same time with several instances of encoder running in parallel. In this case, no threads support is required from the encoder itself, as the OS will take care of scheduling encoder processes to available CPU cores.

2
  • 2
    It might be worth mentioning GNU Parallel and xjobs in your second paragraph, to schedule the right number of simultaneous workloads over the available cores. Commented Aug 24, 2016 at 12:04
  • @TobySpeight I'd like to hear back from the OP first, maybe he has a single file or stream to encode. Commented Aug 24, 2016 at 12:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .