this post was submitted on 02 Apr 2024
29 points (89.2% liked)

Asklemmy

43906 readers
1062 users here now

A loosely moderated place to ask open-ended questions

Search asklemmy ๐Ÿ”

If your post meets the following criteria, it's welcome here!

  1. Open-ended question
  2. Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
  3. Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
  4. Not ad nauseam inducing: please make sure it is a question that would be new to most members
  5. An actual topic of discussion

Looking for support?

Looking for a community?

~Icon~ ~by~ ~@Double_[email protected]~

founded 5 years ago
MODERATORS
 

i have a bunch of .m4a files in one folder, 1000s. can i automate their conversion somehow?

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 4 points 7 months ago (1 children)

If you're on linux try navigating to the folder in the terminal and running

for i in *.m4a; do ffmpeg -i "$i" "${i%.*}.opus"; done

[โ€“] [email protected] 2 points 7 months ago (1 children)

before doing anything like that.. back up the folder.

[โ€“] [email protected] 4 points 7 months ago (1 children)

Well sure always back up everything but this command will create new .opus files still leaving the original .m4a in the folder too, so even if it errors just delete the bad .opus files and try to resolve your ffmpeg codec issue before retrying the conversion or trying another method. Ffmpeg in my experience always converts with the "makes a new file with your file(s)" method, I've never had it do the "change the file destructively" method.

[โ€“] [email protected] 2 points 7 months ago (1 children)

It'll also error out or prompt to overwrite an existing file unless a flag is passed that tells it to overwrite unattended.

[โ€“] [email protected] 1 points 7 months ago (1 children)

Sure, but if it errors out no harm no foul, and don't pass any flags to overwrite the input file which I had not included above.

While I'm thinking about it, what is that flag? Because afaik ffmpeg can't overwrite and convert the file simultaneously, you have to use a temp file.

[โ€“] [email protected] 1 points 7 months ago

That's the point: you have to go out of your way to accidentally overwrite your input files with ffmpeg.

And no it indeed can't output to the same file as input.