2

I want to do the following conversion:

for f in *.m4a; do 
    (  ffmpeg -i "$f" -f wav - | opusenc --bitrate 38 - "${f%.m4a}.opus" ) & 
done

I know I could use ffmpeg directly to convert to opus, but I want to use opusenc in this case, since it's a newer version.

When I run opusenc after the ffmpeg it works fine, but when I try to run the above I just get a bunch of Stopped and nothing happens.

2

If you use GNU Parallel then this works:

parallel 'ffmpeg -i {} -f wav - | opusenc --bitrate 38 - {.}.opus' ::: *m4a

Maybe that is good enough?

It has the added benefit that it only runs 1 job per cpu thread, so if you have 1000 files you will not overload your machine.

  • +1 Thanks! I haven't installed (or ever used) GNU Parallel, so if there's a way to do it in bash, I'd want to use that. But please don't delete this answer! I might come back to it. :) – Joschua May 29 at 10:03
  • Please see this for installation: oletange.wordpress.com/2018/03/28/… – Ole Tange May 29 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.