Registered Member
|
My question: I'd like to create a desktop entry in (kde dolphins servicemenu) to convert audio/video files.
I have tried it with the following:
Works like a charm when put in /usr/share/kservices5/ServiceMenus/. BUT: The mv command renames the output file to the original filename with its file extension (which is wav but should be mp3). How can i change the command as to rename it from file.wav to file.mp3 within the Exec field? |
Registered Member
|
There are several user-contributed service menus on the kde store such as this one for converting to mp3/ogg that you can look at to see how to others have set these service menus up.
(though, depending on what the tool does with file names, you may need to use a little more shell magic to replace the extension; it looks like that mp3/ogg converter just tacks the new extension onto the end of the file name) btw, the per-user directory for service menus is ~/.local/share/kservices5/ServiceMenus/
airdrik, proud to be a member of KDE forums since 2008-Dec.
|
Registered Member
|
Thanks for the reply but i have already checked some scripts from the kde store and still i face the problem, that the file extension is doubled. Means after conversion the name is file.wav.mp3 what is quite annoying. Any hints how to solve this?
|
Registered Member
|
Here's the command from a service menu that I have to extract audio from mp4 video. It might be helpful for the naming part.
|
Registered Member
|
You don't have to use the bash command, do you? After all, you can call the library and immediately write all the actions that need to be performed with the file.
|
Registered Member
|
And if i don't know much about console commands and these libraries? It's just that, for example, I didn't work with the console at all, if I do something wrong, there won't be any problems, will there? No system files will be damaged?
|
Registered Member
|
Here you do not work with system files, you only specify the name of the file you want to change. If you really don't want to understand everything, there are many programs with a free trial period. So that you can convert video and audio files.
|
Registered Member
|
As mentioned here before, there are plenty of convert service menus available. Just out of curiosity though, what happens when you use the kdemv5 command instead of mv ?
But frankly, if you want to move the converted file, you'd need to add a destination directory, either fixed or by a zenity command. If you just want to convert to mp3, you might use: ffmpeg -i %u -y %u.mp3
This realm's name is Maya. And she speaks Hertz. But Ahamkara makes a fuzz about it.
|
Registered Member
|
I made a single service menu for all kinds of converting. If you want it...
[Desktop Entry] Type=Service ServiceTypes=KonqPopupMenu/Plugin MimeType=video/*;audio/* Actions=convert-webm;convert-mp4;convert-avi;convert-ogg;convert-mkv;convert-mp3;convert-wav;convert-flac X-KDE-Submenu=Convert Icon=video-mp4 [Desktop Action convert-webm] Name=Convert to webm Icon=video-webm Exec=ffmpeg -i %u -y %u.webm [Desktop Action convert-mp4] Name=Convert to mp4 Icon=video-mp4 Exec=ffmpeg -i %u -y %u.mp4 [Desktop Action convert-avi] Name=Convert to avi Icon=video-mp4 Exec=ffmpeg -i %u -y %u.avi [Desktop Action convert-ogg] Name=Convert to ogg Icon=video-x-ogm+ogg Exec=ffmpeg -i %u -y %u.ogg [Desktop Action convert-mkv] Name=Convert to mkv Icon=video-mp4 Exec=file=%f; ffmpeg -i %f -codec copy -strict -2 "${file%.*}.mkv" [Desktop Action convert-mp3] Name=Convert to mp3 Icon=audio-mp3 Exec=ffmpeg -i %u -y %u.mp3 [Desktop Action convert-wav] Name=Convert to wav Icon=audio-x-wav Exec=ffmpeg -i %u -y %u.wav [Desktop Action convert-flac] Name=Convert to flac Icon=audio-flac Exec=ffmpeg -i %u -y %u.flac
This realm's name is Maya. And she speaks Hertz. But Ahamkara makes a fuzz about it.
|
Registered Member
|
Don't you think it's an extra problem in vain as long as there are so many free converters on the internet? But if you still want to create something for yourself, there are several user-contributed service menus on the kde store such as this one for converting to mp3 / ogg that you can look at to see how others have set these service menus. I tried this a while ago to convert mp4 to avi, and I called the library and immediately wrote all the actions that needed to be performed with the file.
|
Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]