12

So I'm trying to convert lots of m4as to mp3s, and I think the best way to do that is using avconv.

The problem is, I can't seem to find any solid examples on how to use avconv.

Looking at the man page, it has a ridiculous amount of flags/options, and I can't make sense of it.

How can I batch convert with avconv?

0

1 Answer 1

30

To do a single file:

$ avconv -i m.m4a m.mp3

To do a batch you could wrap this in a for loop:

$ for i in *.m4a; do
    avconv -i "$i" "${i/.m4a/.mp3}"
done

This will take all the files that are present in the current directory with the extension .m4a and run each of them through avconv. The 2nd argument, ${i/.m4a/.mp3} does a substitution on the contents of the variable $i, swapping out .m4a for .mp3.

NOTE: As a one liner:

$ for i in *.m4a; do avconv -i "$i" "${i/.m4a/.mp3}"; done
5
  • How could I consolidate that loop onto one line? Or would it be easier to just put it in a shell script?
    – evamvid
    Commented Apr 20, 2014 at 4:17
  • @evamvid - see update.
    – slm
    Commented Apr 20, 2014 at 5:28
  • I ended up putting it in a shell script last night, but thanks!
    – evamvid
    Commented Apr 20, 2014 at 20:47
  • 1
    @evamvid - OK. If your issues been resolved can you please mark this A as accepted so other passerby's know that your issue's been resolved.
    – slm
    Commented Apr 20, 2014 at 22:40
  • yeah, just did.
    – evamvid
    Commented Apr 20, 2014 at 23:18

You must log in to answer this question.

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