Thunar custom actions can be used to convert media files by adding a simple command like

avconv -i %f %f.mp3

I would like a command to extract aac sound from mp4 and flv files with a Thunar custom action, just extract the aac eventually in a m4a container, without conversion, similar to this solution (which I do not know how to adapt for Thunar custom actions):

for i in *.mp4; do avconv -i "${i}" -map 0:1 -c:a copy "${i%.mp4}.aac"; done

I have created a more general question about this: Command not working anymore in Thunar custom actions and I have received a good answer. I have edited to extend that answer and cover this question too.

The command mentioned in the question needs to be added to a script which then can be run from Thunar:

#! /bin/sh -e
for i in *.mp4; do avconv -i "${i}" -map 0:1 -c:a copy "${i%.mp4}.m4a"; done

A simpler command also works:

avconv -i %f -map 0:1 -c:a copy %f.m4a

which is just a modification of

avconv -i %f %f.mp3

Update: improved command

ffmpeg can be used instead of avconv

And add this to Thunar custom actions;

bash -c 'ffmpeg -i "$0" -map 0:1 -c:a copy "${0%%.*}".m4a' %f

setting *.flv;*.mp4 for appearance conditions.

(for webm video replace with ogg, use mediainfo to get info on the audio stream of the video).

Source of the above here and here.

Your Answer

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