Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Opening a terminal in a folder that contains a flv file called "one" (one.flv) and running this command: ffmpeg -i one.flv one.mp3 the flv file is converted to mp3 with the same name and in the same location.

What is the command that can be added (as shown here) so that the same result could be achieved directly from PCManFM's "Open with" context menu?


By trial and error I have naively found something that works in a way - a command like

ffmpeg -i %f.mp3 

would convert the file to mp3 but put it in the home folder and with no name. Using a such command creates a ".desktop" file in ~/.local/share/applications that can be edited (to change name and icon). I have added this command to context menu and edited the name and icon:

enter image description here

How to modify it so as to output into the same folder and with the same name?

Also: what would be the command that added in the same way would allow converting multiple selected files?

share|improve this question

2 Answers 2

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.)

First did this procedure after selecting audio files, and then again after selecting video files. Each time, after selecting the files, context menu/"open with"/"open with"/custom command line. Each time browsed for soundconverter in usr/bin. Then edited the two resulting ".desktop" files in ~/.local/share/applications to make them look like this:

[Desktop Entry]
Type=Application
Name=Send audio to Soundconverter
Exec=/usr/bin/soundconverter %F
Categories=Other;
NoDisplay=true
MimeType=audio
Icon=soundconverter

and

[Desktop Entry]
Type=Application
Name=Send video to Soundconverter
Exec=/usr/bin/soundconverter %F
Categories=Other;
NoDisplay=true
MimeType=video
Icon=soundconverter

One entry will appear for video files and the other for audio.

share|improve this answer

Now I do not use PCManFM, but the command to be added (works in Thunar) should be something like ffmpeg -i %f %f.mp3 or avconv -i %f %f.mp3.

To run that in Terminal, gnome-terminal --window-with-profile=new1 -e "avconv -i %f %f.mp3". (In Gnome Terminal, create a new profile called "new1" and edit it ('Edit/Profiles/Title and Command') to 'When command exits: Hold the Terminal open'.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.