2

I have added a simple command avconv -i %f %f.mp3 to Thunar's custom actions to convert a selected media file to mp3 (in the same folder and with the same name).

enter image description here

What would be the command that can be added in the same way that would allow selecting multiple files or an entire folder to convert them to mp3 (with the source's folder and name)?

I expect them to be converted one by one (not in parallel, that is, not all at the same time) - but I was wandering if that could be done with one context menu command after selecting multiple files.


It looks like avconv does not support multiple files per input (see comment under here), I am not asking necessarily for a command that includes avconv, but for any other solution.

2
  • 1
    I don't know the answer but are you sure you want to do something like that? CPU usage will be very high during the conversion.
    – user25656
    Jan 31, 2013 at 1:08
  • @vasa1: thanks for noticing that the formula "instead of one by one" is misleading: i want them converted one by one, but after selecting them all and running one command from context menu. i'll edit
    – user47206
    Jan 31, 2013 at 11:47

2 Answers 2

4
+100

It depends a little, on how Thunar handles multiple files. Basically, you can use parallel (website) to handle a lot of files.

sudo apt-get install parallel

So I would start with the following:

parallel avconv -i '{}' '{}.mp3' ::: %F

By default, it only does one job at a time. If you want to use multiple CPU cores in parallel, try parallel -j 4 ... for 4 jobs in parallel. Also check out man parallel.


In order to run it in Thunar's custom actions, this should be embedded like so:

xfce4-terminal -e "parallel avconv -i '{}' '{}.mp3' ::: %F"


To convert to other audio formats supported by avconv, just replace mp3 with that - but: take into consideration other issues like:

  • flv and mp4 files contain aac audio and converting that to other audio formats may entail unwanted results - more here. If the aac file has about 95 kbps bitrate converting directly to mp3 would work, because the default bitrate for the mp3 would be 192kbps, which is a good option (according to here). If the aac file has a different bitrate, the mp3 should be modified accordingly.

  • aac is a lossy format, and converting it to other formats should be considered in the context of the larger issue that converting between lossy formats is not recommendable. Even more, converting from a lossy format to a lossles one is pointless.

  • a better option than converting aac to mp3 would be to just extract the aac audio into a m4a container, as described here.

0
1

This will not stand as accepted answer.

Initially I was not thinking about a GUI. But, this is a way of doing it too. It will not convert directly, but will add selected files to Soundconverter list. (The main advantage is that supplementary settings are at hand.)

The command to be added to custom actions is

/usr/bin/soundconverter %F

Appearance conditions: video and audio.

2
  • This has the nice side effect, that you can see the progress. Apr 30, 2013 at 15:18
  • @queueoverflow yes, if soundconverter would always work, which it does not
    – user47206
    Apr 30, 2013 at 15:27

You must log in to answer this question.