Bugzilla – Bug 483
Add supported mime type in audacity.desktop
Last modified: 2018-08-20 11:45:30 UTC
Created attachment 239 [details] additional-mime-types.patch Please add supported mime type in audacity.desktop like audio/flac. These mime types needs to be added depending on the application configuration.
Sorry, Benjamin, as only a casual Linux user I can't comment or rate the issue as there are no steps to reproduce. So even if I applied the patch I would have no idea what to test to see if the issue was fixed. Your post on -devel says "Add supported mime type in audacity.desktop if FFmpeg is enable."
My comment on the mailing list was incorrect: It should be 'if built against libflac' instead of 'if FFmpeg is enabled' Your file browser allows you to open a file with Audacity if the mime type of the file is listed in the mime type field in audacity.desktop. Steps to reproduce: 1) Open Nautilus 2) Navigate to a flac file 3) Right click on the flac file 4) You should see 'Open with Audacity' or 'Open with -> Audacity' if Audacity is built against libflac Make sure that you do not have the audacity Debian package installed when doing the test.
Created attachment 264 [details] updated patch
(In reply to comment #2) Benjamin, the patch was stale for configure.in so I attach what I applied; maybe I got it wrong but after install of HEAD and reboot there is no open with Audacity for flac files in Nautilus. I just use standard ./configure for Audacity so it uses local flac libraries. If I should build Audacity some other way please state how e.g. using system libflac - or have I to build libflac and use pkg-config or whatever? However if it doesn't work with default configure is it a feature worth having? Also what about FFmpeg formats - should patch include those? Right-click over a wma or aac file gives open with VLC.
Did you ran ./autogen.sh to update the configure script after applying the patch? The patch should work regardlessly if the system or the local libflac is used. No special treatment should be necessary. I did a quick test with './configure --with-libflac=local' and confirm that src/audacity.desktop contains 'audio/flac'. PS: Your applied patch added trailing spaces in configure.in.
Created attachment 265 [details] ffmpeg-mimetypes.patch Adding mime types from FFmpeg is very easy with my proposed patch. I attached a accumulative one-line patch that add AAC and WMA to the supported mime types if FFmpeg is supported. Please run ./autogen.sh after applying the patch. Are there more supported mime types?
Created attachment 266 [details] additional-mime-types-v2.ptach Here's the patch combined with a TortoiseSVN friendly strip level 0.
Applied ffmpeg-mimetypes.patch. Do not know which of the prior two patches is preferred.
(In reply to comment #7) Hi, Benjamin. I see you got rid of the previous two competing patches. Gale, does this one solve the issues you previously had?
Created attachment 270 [details] additional-mime-types-v3.ptach Vaughan, thanks for applying the second patch (ffmpeg-mimetypes.patch). There is a typo in my name in the commit message. ffmpeg-mimetypes.patch depends on the additional-mime-types.patch and has no effect without it. I attached the remaining patch that needs to be applied to get it working. Please do not forget to run ./autogen.sh to update the configure file after applying the patch.
(In reply to comment #10) > [...]There > is a typo in my name in the commit message. Sorry. > > ffmpeg-mimetypes.patch depends on the additional-mime-types.patch and has no > effect without it. I attached the remaining patch that needs to be applied to > get it working. > > Please do not forget to run ./autogen.sh to update the configure file after > applying the patch. > I don't have a Linux system. Somebody else will have to do this one.
(In reply to comment #11) @Benajamin, re: the previous flac-only patch, yes I did run ./autogen.sh, and audacity.desktop contains 'audio/flac' but Nautilus still does not show Audacity in "Open with" against flac files. It could be a problem on that Ubuntu 12.04 netbook - it has some oddities with environment variables. In due course I will test on Ubuntu 11.10 64-bit as well.
Gale, did you used svn revision 11816 or later (that applied fix-file-opening-with-audacity.patch) in your test?
(In reply to comment #13) > Gale, did you used svn revision 11816 or later (that applied > fix-file-opening-with-audacity.patch) in your test? No, I was at r11812, before Vaughan committed any of your patches. Is that the explanation of the difference we see?
That could be an explanation. Can you retest with the latest svn revision? An other explanation could be that a mime cache needs to be updated.
(In reply to comment #15) > Can you retest with the latest svn revision? An other explanation > could be that a mime cache needs to be updated. I assume you mean test the additional-mime-types.patch (not yet committed) with HEAD (which has the ffmpeg-mimetypes.patch). No change (Ubuntu 12.04 netbook). Audacity not listed in Open with for FLAC (or WMA or AAC). When I click "Other application..." underneath "Open with" and click "Show other applications", Audacity is not listed. I ran rm -rf $HOME/.local/share/mime/* then sudo update-mime-database /usr/share/mime/ . I don't know if these are sensible commands but the machine took a bit of time then did not error after the commands. After sudo update-mime-database /usr/share/mime/, I do not see Audacity in "Open with" but it can now be selected in "Other applications". After that, the Audacity item for a flac file in "Open with" works correctly. But I guess this still means I am not seeing the result I should.
(In reply to comment #16) > I assume you mean test the additional-mime-types.patch (not yet committed) Yes, this is P4, and came in after code/string freeze for rc2, so not committed. Will not hold up 2.0.1.
> I assume you mean test the additional-mime-types.patch (not yet committed) Yes > I do not see Audacity in "Open with" but it can now be selected in > "Other applications". After that, the Audacity item for a flac file > in "Open with" works correctly. That's exactly the desired result. Audacity is not listed in "Other applications" without the patch.
(In reply to comment #18) >> I do not see Audacity in "Open with" but it can now be selected in >> "Other applications". After that, the Audacity item for a flac file >> in "Open with" works correctly. > That's exactly the desired result. Audacity is not listed in "Other > applications" without the patch. Hi Benjamin, But you say in your "steps to reproduce" > 4) You should see 'Open with Audacity' or 'Open with -> Audacity' if > Audacity is built against libflac I only see Open with > Audacity if I actually go to "Other applications" and add Audacity. But for e.g. WAV and MP3 I already see default "Open With Audacity" pre-patch and without using "Other applications" (though Audacity is not in that "Other applications" list" - I don't know if Ubuntu removes Audacity from that list if there is already "Open With Audacity"). So at best we are being inconsistent. Personally I don't want a default association with Audacity for MP3 when I don't ask for it. I would like to see "Open With Audacity" underneath the divider in the right-click context menu,for all common media formats, as I do with VLC, without using "Other applications". But your patch does not add that for me for FLAC or FFmpeg formats.
Okay, I was wrong. I investigated the behavior of Nautilus. The last step should be: 4) You should see Audacity under 'Recommended Applications' when opening 'Open with -> Other application...' An application is recommended if the mime type is supported by the application. Otherwise it will listed under 'Other Applications'. It seems that the recommended application are shown in the 'Open With ...' list. This patch has no effect on the default association for a given mime type. The default association is specified in /usr/share/applications/defaults.list If you see the mime types listed in your installed .desktop file, but to not see Audacity as recommended application for these mime types, you probably need to correctly update the mime cache. I don't know how to correctly update the mime cache, because the package manager does the job for the Audacity package.
(In reply to comment #20) > 4) You should see Audacity under 'Recommended Applications' when opening 'Open > with -> Other application...' I don't see that (on Ubuntu 12.04 machine). Audacity is not in "Recommended Applications" until I click "Show Other Applications" and select Audacity. What your patch seemed to do was to make Audacity appear in "Other applications" - previously it was not even in the "Other applications" list. > An application is recommended if the mime type is supported by the application. So WMA/AAC/FLAC etc should be supported if Audacity is compiled against FFmpeg and FLAC, do you agree? But I still don't see Audacity in the Recommended list when right-clicking over those formats. And usually if an application is in the "Recommended" list, then it is already in the "Open with" list. I still don't see why your patch doesn't do what already happens for e.g. WAV and MP3 (right-click over the file, Audacity is already listed as a selectable application and already in the "Recommended" list). I did not add Audacity for those formats, it was there already.
Created attachment 275 [details] additional-mime-types-v4.patch (In reply to comment #21) > I don't see that (on Ubuntu 12.04 machine). Audacity is not in "Recommended > Applications" until I click "Show Other Applications" and select Audacity. I have no clue why it does work differently on your system. > So WMA/AAC/FLAC etc should be supported if Audacity is compiled against FFmpeg > and FLAC, do you agree? Yes, that's exactly what the patch does. The MimeType field of the audacity.desktop file list all supported mime types depending on the used libraries. > I still don't see why your patch doesn't do what already happens for e.g. WAV > and MP3 (right-click over the file, Audacity is already listed as a selectable > application and already in the "Recommended" list). I did not add Audacity for > those formats, it was there already. Can you verify that the MimeType field in the installed audacity.desktop contains all mime types that should be supported in your setup? I attached a new version of the patch. Without all libraries, only application/x-audacity-project; is supported. All other mime types are added if Audacity is build with the corresponding library (like libmad, libsndfile, and libvorbis).
(In reply to comment #22) Benjamin, I applied your v4 patch on Ubuntu 12.04 32-bit and 11.10 64-bit. The finding is the same on both systems (now that I updated mime types on 12.04). Right-click over FLAC and FFmpeg formats does not show Audacity in the right-click context menu. From that context menu, I choose "Open With Other Application". Audacity is not in "Recommended Applications". I click "Show other applications". Before the patch, Audacity was not listed in "Other applications". After the patch, Audacity is listed in "Other applications". If I select Audacity in the "Other applications" list, Audacity will then be listed in Recommended Applications" and appears in the right-click context menu as "Open With Audacity". > > I still don't see why your patch doesn't do what already happens for e.g. > > WAV and MP3 (right-click over the file, Audacity is already listed as a > > selectable application and already in the "Recommended" list). I did not > > add Audacity for those formats, it was there already. > > Can you verify that the MimeType field in the installed audacity.desktop > contains all mime types that should be supported in your setup? Here is what audacity,desktop says after the patch (on both versions of Ubuntu) [Desktop Entry] Name=Audacity Name[de]=Audacity Name[ru]=Audacity GenericName=Sound Editor GenericName[de]=Audio-Editor GenericName[ru]=Редактор звуковых файлов Comment=Record and edit audio files Comment[de]=Audio-Dateien aufnehmen und bearbeiten Comment[ru]=Запись и редактирование звуковых файлов Icon=audacity Type=Application Categories=AudioVideo;Audio;AudioVideoEditing; Exec=audacity %F StartupNotify=false Terminal=false MimeType=application/ogg;audio/basic;audio/mpeg;audio/x-aiff;audio/x-mp3;audio/x-wav;application/x-audacity-project; Of course for the bottom line of the above, src/audacity.desktop.in has MimeType=application/x-audacity-project;@MIMETYPES@. What effect is audacity.desktop.in supposed to have on audacity.desktop? I edited the last line of audacity.desktop to MimeType=application/x-audacity-project;@MIMETYPES@ and rebooted, but nothing changed for FLAC or FFmpeg formats. Also I note that with audacity.desktop in either state, right-click over MP2 files only shows Audacity as "Other", not "Recommended" (unlike WAV/AIFF/OGG/MP3 native formats where Audacity is recommended to begin with, without user action). So the patch has the benefit for non-native formats of allowing Audacity to appear in "Other applications". It does not do for non-native formats what happened before for native formats (except MP2). I don't know on a virgin Ubuntu system whether MimeType=application/x-audacity-project;@MIMETYPES@ means that native formats won't now get automatic association either. That would be a backwards step. Have you tested that by installing clean Ubuntu on a new partition?
> What effect is audacity.desktop.in supposed to have on audacity.desktop? The configure script replaces @MIMETYPES@ in audacity.desktop.in by the actual list of mime types and saves the result as audactiy.desktop. This transformation worked as you could see. "MimeType=application/x-audacity-project;@MIMETYPES@" from the audacity.desktop.in file should never end up in the actual installed desktop file. > Have you tested that by installing clean Ubuntu on a new partition? I took a clean Ubuntu system (with no audacity package installed). Then I grabbed the latest source, applied my patch, ran ./autogen.sh, configure, make, sudo make install. After that I ran: sudo update-mime-database /usr/local/share/mime sudo update-desktop-database /usr/local/share/applications The first command make sure that the /usr/local/share/mime/audacity.xml is getting known and the second command makes sure that /usr/local/share/applications/audacity.desktop is getting known. After running these two commands, Audacity appears in the right-click context menu as "Open With Audacity" for WAV/AIFF/OGG/MP3.
(In reply to comment #24) Thanks, Benjamin for explanation and tests. > Audacity appears in the right-click context menu as "Open With Audacity" > for WAV/AIFF/OGG/MP3. Do we need to do anything for MP2 so that behaves the same as other native formats? After we decide that, are you recommending we commit your patch? If yes, should there still be some issue open why (if support for FFmpeg and FLAC is compiled in) user has to drill through to "Other applications" to set up Audacity association for those formats? Or is it "expected" for some reason?
(In reply to comment #25) > Do we need to do anything for MP2 so that behaves the same as other native > formats? We need to add the mimetype for MP2 (video/mpeg in Ubuntu) to the library that enables MP2 support. I am happy to extent my patch if you tell me which library enables MP2 support. > After we decide that, are you recommending we commit your patch? I wouldn't have posted the patch if I wouldn't recommend to commit it. ;) > should there still be some issue open why (if support for FFmpeg and > FLAC is compiled in) user has to drill through to "Other applications" to set > up Audacity association for those formats? No unless we forgot some mime types or the user forgot to run update-desktop-database. Please let me know if some Audacity libraries support formats that we haven't added to the mime list yet and will add them.
(In reply to comment #24) > I ran: > sudo update-mime-database /usr/local/share/mime > sudo update-desktop-database /usr/local/share/applications > > The first command make sure that the /usr/local/share/mime/audacity.xml is > getting known and the second command makes sure that > /usr/local/share/applications/audacity.desktop is getting known. > > After running these two commands, Audacity appears in the right-click context > menu as "Open With Audacity" for WAV/AIFF/OGG/MP3 Assuming you compiled Audacity with FLAC and FFmpeg support, did Audacity appear in the right-click context menu as "Open With Audacity" for FLAC and FFmpeg formats? That is what I have never seen. (In reply to comment #26) > We need to add the mimetype for MP2 (video/mpeg in Ubuntu) to the library > that enables MP2 support. I am happy to extent my patch if you tell me > which library enables MP2 support. twolame is the mp2 encoder and libmad is the mp2 decoder. > Please let me know if some Audacity libraries support formats that we > haven't added to the mime list yet and will add them. Have we fully covered FFmpeg ( http://wiki.audacityteam.org/wiki/FFmpeg_integration#Functionality )? I have seen that some obscure FFmpeg formats e.g MKV show Audacity in "Other Applications", so addable (but again, user cannot add the Audacity association unless they click "Other Applications" because Audacity is not a "Recommended Application").
> Assuming you compiled Audacity with FLAC and FFmpeg support, did Audacity > appear in the right-click context menu as "Open With Audacity" for FLAC and > FFmpeg formats? Yes. > That is what I have never seen. Please run sudo update-mime-database /usr/local/share/mime sudo update-desktop-database /usr/local/share/applications and then you should see it too. You might need to adjust the paths for these two commands if you compiled audacity with a different --prefix. > Have we fully covered FFmpeg > ( http://wiki.audacityteam.org/wiki/FFmpeg_integration#Functionality )? > I have seen that some obscure FFmpeg formats e.g MKV show Audacity in "Other > Applications", so addable (but again, user cannot add the Audacity association > unless they click "Other Applications" because Audacity is not a "Recommended > Application"). User can always find Audacity in "Other Applications", even for unsupported file formats. Adding a mime type to the desktop files let Audacity move from "Other Applications" to "Recommended Application". I think that we should conservative. We should only add mime types that are fully supported. video/mpeg is not only used for MP2 files, but for MPEG videos as well. The current patch adds FLAC and ogg. We can add more mime types later.
Created attachment 309 [details] additional-mime-types-v5.patch Here's an updated patch. It removes audio/x-mp3 (audio/mpeg is the correct mime type for mp3 files) and adds audio/ac3 for AC3 files. With this updated patch all file formats that are listed in the export dialog have a corresponding mime type entry (except MP2, which has video/mpeg as mime type). Following file formats will be added if this patch is applied: AAC (audio/aac), AC3 (audio/ac3), MP4 (audio/mp4), FLAC (audio/flac or audio/x-flac), OGG (audio/x-vorbis+ogg), WMA (audio/x-ms-wma)
Hi Benjamin, > User can always find Audacity in "Other Applications", even for unsupported > file formats. I wasn't even finding that, before your patches. Audacity was not listed in "Other Applications". > I think that we should conservative. We should only add mime types that are > fully supported. video/mpeg is not only used for MP2 files, but for MPEG > videos as well. With this updated patch all file formats that are listed in > the export dialog have a corresponding mime type entry (except MP2, which > has video/mpeg as mime type). I am not a mime types expert, but I believe audio/mpeg (http://tools.ietf.org/html/rfc3003) includes MPEG1 (http://en.wikipedia.org/wiki/MPEG-1) and so includes MP2 format (http://en.wikipedia.org/wiki/MPEG-1_Audio_Layer_II) as well as MP3. I have not researched it, but I don't see why we'd need to specify video/mpeg to acquire a mime type entry for MP2 (which is an important audio format for broadcasters). Also, I would argue video/mpeg is pretty close to fully supported. Which video formats covered by video/mpeg do not import (as audio) into Audacity when FFmpeg is installed?
Created attachment 310 [details] additional-mime-types-v6.patch > I have not researched it, but I don't see why we'd need to specify video/mpeg > to acquire a mime type entry for MP2. "mimetype test.mp2" says video/mpeg on Ubuntu 12.04 instead of the expected audio/mpeg. > Also, I would argue video/mpeg is pretty close to fully supported. Which video > formats covered by video/mpeg do not import (as audio) into Audacity when > FFmpeg is installed? I tested some .avi and other mpeg video files with Audacity. All files were correctly opened. Therefore I added video/mpeg to the mime types of FFmpeg (updated patch attached).
Patch 6 committed.
tested on Ubuntu 11.10 and 12.04 per your instructions. AVI/MPG/WMA/FLAC do not show "Open with Audacity" on right-click. Neither does MP2 - do you have to build with FFmpeg support to get that? I did build with FFmpeg support. But there is no /usr/local/share/applications/audacity.desktop as you say there should be. There is mimeinfo.cache in /usr/local/share/applications. I did not change install prefix of Audacity and do sudo make install. Search for audacity.desktop only finds the copy in ~/audacity/src.
(In reply to comment #33) > there is no /usr/local/share/applications/audacity.desktop as you say there > should be Apparently there is a Nautilus bug that does not display that file (show hidden files or otherwise). The file is visible in Gnome Commander. If I delete /usr/local/share/applications/audacity.desktop then install Audacity, I can see the install command copying audacity.desktop from the Audacity source tree to /usr/local/share/applications/. So "sudo update-desktop-database /usr/local/share/applications" (if the correct command) is presumably finding the correct file, but it still doesn't work on my systems. And even if it is the correct command, I have to ask - why do we expect the user to know and run two such commands to give them file associations?
> AVI/MPG/WMA/FLAC do not show "Open with Audacity" on right-click. Neither does > MP2 - do you have to build with FFmpeg support to get that? I did build with > FFmpeg support. You need to build with FFmpeg to get AVI/MPG/WMA as supported mime types. You need to build against libflac for to get FLAC as supported mime type. > So "sudo update-desktop-database /usr/local/share/applications" (if the correct > command) is presumably finding the correct file, but it still doesn't work on > my systems. And even if it is the correct command, I have to ask - why do we > expect the user to know and run two such commands to give them file > associations? Nautilus seems to use mimeinfo.cache (which is created by the update-desktop-database command above) instead of scanning all desktop files. I have to clue why it is not working on your system. It works in the Debian/Ubuntu package. The package manager takes care to update the caches correctly there.
(In reply to comment #35) > You need to build with FFmpeg to get AVI/MPG/WMA as supported mime types. > You need to build against libflac for to get FLAC as supported mime type. OK so I meet that requirement already. > Nautilus seems to use mimeinfo.cache (which is created by the > update-desktop-database command above) instead of scanning all > desktop files. Fix Nautilus then? It certainly can't see /usr/local/share/applications/audacity.desktop, which doesn't inspire confidence. > I have to clue why it is not working on your system. Systems plural - 12.04 and 11.10 (the latter was fresh installed from your ISO). Perhaps you are doing some unstated step as a developer or have some unstated package installed that I do not? You could perhaps ask on the Audacity Forum if you want a second opinion if a non-developer could actually make this work.
(In reply to comment #36) >> You need to build with FFmpeg to get AVI/MPG/WMA as supported mime types. >> You need to build against libflac for to get FLAC as supported mime type. > OK so I meet that requirement already. Just to be clear, I am only using default ./configure with Audacity which builds with support for FLAC and FFmpeg. I can use a locally built FFmpeg by loading it from Libraries preferences. But ldd audacity | grep av produces no output. Do I have to do more to explicitly link Audacity to libflac and ffmpeg when I compile Audacity to make these file associations work (in Nautilus)? Note that GNOME Commander right-click over files sees Open with Rhythmbox Open with ... > Audacity for all FFmpeg formats including videos, for FLAC and for all Audacity native formats, but not MP2 and not OGG. So clearly Nautilus is a major part of the problem. Are you saying that in your Ubuntu installation, Nautilus can navigate to /usr/local/share/applications and actually see audacity.desktop?
Steve told me on his Debian system: > Just tested with a Flac file. > "Open With > Other Application > (wait for list to be populated) > > Audacity (Remember this application for Flac audio files). > Thereafter: > "Open With > Audacity" Unless Benjamin comments further I'm guessing I'm encountering bugs in Nautilus/GNOME Commander and /or Ubuntu. Benjamin's patch did improve things by allowing me to drill through other applications to find Audacity - previously I could not add Audacity at all. So I suggest resolving WORKSFORME (though it doesn't for this writer).
RESOLVED - WORKSFORME as suggested in comment 38.
> Do I have to do more to explicitly link Audacity to libflac and ffmpeg when I > compile Audacity to make these file associations work (in Nautilus)? The type of linkage is unrelated to the supported mime types specified in a .desktop file. As long a the mime types are listed in your audacity.desktop file, the issue is not on the audacity side. > So clearly Nautilus is a major part of the problem. Are you saying that in your > Ubuntu installation, Nautilus can navigate to /usr/local/share/applications and > actually see audacity.desktop? Nautilus shows the name entry from a .desktop file as file name instead of using the actual file name. I can see an 'Audacity' file in /usr/local/share/applications, which is actually /usr/local/share/applications/audacity.desktop.