Thunar – Command Not Working Anymore in Custom Actions

commandconversionmultimediathunar

I used to create a Thunar custom action as presented here in order to extract audio without transcoding from selected (multiple) video files .

The command to be added in Thunar custom actions list was:

 xfce4-terminal -e "parallel avconv -i '{}' -map 0:1 -c:a copy '{}.m4a' -- %F"

now I get only this:

parallel: Warning: Input is read from the terminal. Only experts do this on purpose. Press CTRL-D to exit.

Why is that and how to adapt such commands so that they would work in
Thunar custom actions?

Best Answer

I am not sure to understand that command. Why do you put -- before the %F?

Try this:

xfce4-terminal -e "parallel avconv -i '{}' -map 0:1 -c:a copy '{}.m4a' ::: %F"

Explanation: As I understand the %F is what Thunar replaces by the files, and parallel uses ::: for the input.

One example in the manpage is, precisely

parallel gzip {} ::: file1 file2

To add to Thunar custom action a command like the one from here

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

first add that into an executable script, like

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

Make it executable and save it.

In Thunar custom actions add a new entry with the command bash /path/to/the/script %F and the following conditions:

enter image description here

This needs separate custom actions for each file type (because it is limited to mp4 to m4a: make changes accordingly for flv to m4a, webm to ogg, avi to mp3 etc) but has the advantage that the output keeps the exact input name (file.mp4 becomes file.m4a), while with the first command does not (file.mp4 becomes file.mp4.m4a).

Related Question