Audacity Bug Summary
••• Introduction •••
••• Keywords •••
    Audacity 3.0.3 development began 19th April 2021

Audacity Bugzilla



Bug 311 - Slow import of ogg if libsndfile OD-handles it, then slow export to all formats
Slow import of ogg if libsndfile OD-handles it, then slow export to all formats
Status: RESOLVED FIXED
Product: Audacity
Classification: Unclassified
Component: Formats
1.3.14 alpha
PC Linux
: P4 Review
Assigned To: Default Assignee for New Bugs
: Slow
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-09 06:11 UTC by Benjamin Drung
Modified: 2018-08-20 11:45 UTC (History)
4 users (show)

See Also:
Steps To Reproduce:
Release Note:
First Git SHA:
Group: ---
Workaround:
Closed: 2018-08-20 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Drung 2011-03-09 06:11:23 UTC
audacity trunk takes very long to open an ogg file and to export this file to every format (WAV, FLAC, ...).

I used Cellule from Silence [1] as test case. With audacity 1.3.12 the import took around one second and the export to WAV took around one second. With audacity trunk opening the file took around 20 seconds and exporting to WAV took 53 seconds. When opening the exported WAV file, the export to WAV and WMA took only a few seconds.

System: Ubuntu 10.10 (maverick)

[1] http://www.jamendo.com/en/download/track/5339
Comment 1 Gale Andrews 2011-03-09 07:15:32 UTC
 http://www.jamendo.com/en/download/track/5339 is an MP3, though. Is the issue with export from all compressed formats?
Comment 2 Benjamin Drung 2011-03-09 07:47:12 UTC
You can get the album in ogg format [1]. I used Cellule (the first title) as test case. Other ogg files have the issue. This issue is specific to ogg (mp3, flac, and wav files worked as expected).

[1] http://www.jamendo.com/en/album/830
Comment 3 Leland Lucius 2011-03-09 11:24:27 UTC
I must be doing something wrong cause the 1.3.12 Ubuntu Audacity and a self-built trunk work almost the same here.  But, I'm probably not a good tester for this though since I'm doing this in a virtual machine and disk speed isn't the greatest.
Comment 4 Benjamin Drung 2011-03-09 12:20:51 UTC
The disk speed is not the limit here, the CPU power is the limit. Can you do this simple test: Open a random file, export it to .ogg and see how long it takes. Then open the exported .ogg file, export it to .ogg again, and see how long that takes. On my system the first export takes seven seconds, the second export takes five minutes (for the same data)!

Opening an .ogg files takes much longer than the corresponding .wav/.mp3 file.
Comment 5 Leland Lucius 2011-03-09 12:58:27 UTC
(In reply to comment #4)

I'm just not seeing it.  Here's what I did:

1)  Downloaded the Cellule.mp3
2)  File->Open Cellule.mp3
    Took about a second
3)  File->Export Cellule.ogg with filetype dropdown set to "Ogg Vorbis Files"
    Took about 9 seconds
4)  File->Open Cellule.ogg
    Took about 1 second
5)  File->Export Cellule2.ogg with filetype dropdown set to "Ogg Vorbis Files"
    Took about 9 seconds

This is on Ubuntu 10.10 and a recent checkout of trunk.  I got the same results with the Ubuntu supplied Audacity.

This is in a Fusion VM with 4 processors and 1GB of memory.  The real machine as 8 cores at 3.2Ghz and 10GB of memory.  Plenty of free memory and no swapping in both OSes.

An excerpt from configure:

configure:8747: Figuring out what libraries to enable
configure:8764: Using LOCAL libraries for LIBVORBIS
configure:8764: Using LOCAL libraries for LIBMAD
configure:8764: Using LOCAL libraries for LIBSNDFILE
configure:8764: Using LOCAL libraries for LIBFLAC
configure:8764: Using LOCAL libraries for LIBID3TAG
configure:8764: Using LOCAL libraries for LIBSAMPLERATE
configure:8764: Using LOCAL libraries for LIBRESAMPLE
configure:8764: Using LOCAL libraries for LIBSBSMS
configure:8764: Using LOCAL libraries for LIBSOUNDTOUCH
configure:8764: Using LOCAL libraries for LIBNYQUIST
configure:8764: Using LOCAL libraries for LIBVAMP
configure:8764: Using LOCAL libraries for LIBEXPAT
configure:8764: Using LOCAL libraries for LIBTWOLAME
configure:8764: Using LOCAL libraries for FFMPEG
configure:8764: Using LOCAL libraries for PORTSMF
configure:8832: Both libresample and libsamplerate are available
configure:8834: deciding which to use based on arguments ...
configure:8839: Libsamplerate not explicity requested, using libresample
Comment 6 Benjamin Drung 2011-03-09 13:01:40 UTC
Please test trunk with the system libvorbis.
Comment 7 Leland Lucius 2011-03-09 13:12:08 UTC
(In reply to comment #6)
Will do.  Unfortunately, I must be off to work.  (I hate when it gets in the way of fun stuff!  ;-))
Comment 8 Gale Andrews 2011-03-09 14:14:26 UTC
(In reply to comment #4)
SVN HEAD Ubuntu 10.10 (not a VM) configured with system libvorbis. Project rate 44100 Hz at all times.  
> Open a random file, export it to .ogg and see how long it takes. 
Imported a 3 minute WAV file. OGG export took 24 seconds.
 
> Then open the exported .ogg file, export it to .ogg again, and see how
> long that takes.
24 seconds. 

> On my system the first export takes seven seconds, the second export takes 
> five minutes (for the same data)!
There is no resampling going on for the second export, correct? 

> Opening an .ogg files takes much longer than the corresponding .wav/.mp3 file.
Exported an MP3 from the same project and tested. OGG and MP3 import both take 4 seconds. 

Repeated all tests in 1.3.12 Ubuntu packaged version. No significant differences.
Comment 9 Leland Lucius 2011-03-09 17:54:01 UTC
(In reply to comment #6)
Retried with system library and got similar results...no slowdowns.

Leland
Comment 10 Benjamin Drung 2011-03-13 10:35:32 UTC
> There is no resampling going on for the second export, correct?

Yes, no resampling.

The Audacity 1.3.12 package doesn't have this issue. Only trunk is affected even after a hardware upgrade.

Audacity 1.3.12 takes one second to open the example ogg file, trunk takes 7 seconds for the same file.

When exporting the ogg file to flac (for example), the remaining time start at 30 seconds and then raises up and up. I monitored the system. The memory usage stays constant (and no swapping).

Can you configure trunk with "--with-sbsms=local --with-libsamplerate=system" and all other libraries as system libraries and try again?
Comment 11 Benjamin Drung 2011-03-13 12:49:42 UTC
I configured audacity to use all local libraries and the import/export was fast. Then I configured audacity to use all system libraries and the import/export was slow again. I played with the configure flags until I found the configure flag that makes the difference:

When using the system libsndfile, the import/export is slow. When using the local libsndfile, the import/export is fast as expected.

Can you use "--with-libsndfile=system" and tell me if you can reproduce the issue?
Comment 12 Gale Andrews 2011-03-13 14:02:14 UTC
(In reply to comment #11)
> When using the system libsndfile, the import/export is slow. When using the
> local libsndfile, the import/export is fast as expected.
> Can you use "--with-libsndfile=system" and tell me if you can reproduce the
> issue?
Default ./configure already produces use of system libsndfile, so I believe I have already tested.

And if one of your issues was export from ogg to ogg (5 minutes), I'm not following what libsndfile has to do with that.
Comment 13 Benjamin Drung 2011-03-14 07:10:15 UTC
> And if one of your issues was export from ogg to ogg (5 minutes), I'm not
> following what libsndfile has to do with that.

I don't know why, but libsndfile makes a difference. Maybe some strange side effect of a compiler option or something like that?

BTW, I am on amd64.
Comment 14 Benjamin Drung 2011-03-15 07:00:14 UTC
> For those experiencing slow exports after importing an OGG file, can you try
> changing "Edit->Preferences->Import/Export->Read uncompressed..." to "Make a
> copy..." and then exit Audacity, get back in, and try to reproduce the
> slowness.

With "Make a copy..." the import and export is fast.

This bug is totally unrelated to FFmpeg.
Comment 15 Leland Lucius 2011-03-15 11:08:53 UTC
(In reply to comment #23 from bug #176)
> That OGG slowness thing is separate (bug 311) but I have never seen it so far. 
> 
> Why would the copy-in Pref affect OGG > OGG? Audacity should copy the OGG in
> irrespective of that setting.

It appears that the Ubuntu 10.10 libsndfile is built to handle OGG files and that is confusing our importer.

Try this:

1)  Start Audacity
2)  Edit->Preferences->Extended Import
    Make sure "Filter chosen in OpenFile..." is not checked and remove all rules
3)  Switch to the Import/Export page
    Make sure "Read uncompressed audio files..." is selected.
3)  Click OK
4)  File->Import->Audio
    Import an OGG file of at least a couple of minutes or so

You should see the file being "on demand" loaded.

The way the importer works when being left to choose how to import the file, it will always check libsndfile first.  Since libsndfile on Ubuntu 10.10 supports loading OGG files, the importer looks no further and proceeds to load the file via libsndfile or more correctly, the ImportPCM importer and since the ImportPCM importer is setup to do on demand loading, OD gets involved and attempts to load the file.

I haven't figured out yet why OD has trouble with this though.  At first glance, it really shouldn't except that the seeking that it does may be causing some issues since we're dealing with an OGG (compressed) file.
Comment 16 Michael Chinen 2012-01-16 04:59:26 UTC
Fix in r11414.

For now I just disabled OGG import via libsndfile with a hardcode and a long comment.  If at some point we want to use an aliased (PCMAliasedBlockFile) OGG file, we will need to revert this patch, or extend it to check the versions of libsndfile.


> I haven't figured out yet why OD has trouble with this though.  At first
> glance, it really shouldn't except that the seeking that it does may be causing
> some issues since we're dealing with an OGG (compressed) file.

Just noting there was a thread from 20.3.2011 with Leland and Erik where you guys found that it was libsndfile having a problem with seeking where any seek would parse the entire file.  FYI, this problem continued to exist after saving the OD imported track, which causes the opened project to be non-OD block files (normal aliased PCMAliasBlockFiles), and the bug still existed there (slow export).
Comment 17 Gale Andrews 2012-01-16 09:52:55 UTC
Changed bug title to "Slow import of ogg if libsndfile OD-handles it, then slow export to all formats". 

I still have Ubuntu 10.10, so will test, but I found it hard to reproduce before.