Thursday, May 2, 2024
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 1914  / 1 Year ago, sun, may 7, 2023, 1:26:00

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?


More From » command-line

 Answers
0

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






Or, even better, to specify constant bit-rate of 192k, replace avconv -i %f %f.mp3 with avconv -i %f -c:a libmp3lame -ac 2 -b:a 190k %f.mp3


[#32924] Monday, May 8, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ithriv

Total Points: 46
Total Questions: 115
Total Answers: 96

Location: Malaysia
Member since Wed, May 11, 2022
2 Years ago
ithriv questions
Tue, Mar 14, 23, 14:31, 1 Year ago
Wed, Oct 5, 22, 02:59, 2 Years ago
Fri, Mar 11, 22, 10:12, 2 Years ago
Thu, May 11, 23, 10:55, 1 Year ago
Sun, Sep 26, 21, 06:47, 3 Years ago
;