-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify ffdec.py by using Popen.communicate() method #113
Comments
Hi! It could be worth looking into! But there are a few reasons why ffdec works this way now:
I believe |
Hi! Thanks for the explanation. |
Since my main goal was to speed up the file loading and you plan to release a new version soon, what do you think about raising the |
Ah, yeah, that's a good point. We probably should be limiting the queue size! It seems tricky to get exactly right, but probably worth a shot nonetheless. Raising the block size seems like a great idea! Would you mind putting together a small PR for that? |
Hi, thanks for this very useful library!
I was looking into
ffdec.py
since I need faster loading of mp3 and m4a files.I believe that the module could be improved and simplified by using the
Popen.communicate()
method. This seems to be the recommended way of retrieving output from a subprocess.The current implementation only allows to read the data in blocks which is suboptimal since a user might not be able to adapt the block size. (E.g. librosa just calls
audio_open()
which has no way of setting a block size.)I did a speed comparison that shows that this way of reading data is slower than it needs to be, especially for large files:
https://gist.github.com/Bomme/d9aee452c8c1e68fb5fac743df6b2a07
If you decide to drop Python 2 support (#112) the timeout handling might be easier.
And for later versions of Python 3 the https://docs.python.org/3/library/subprocess.html#windows-popen-helpers might come in handy.
The text was updated successfully, but these errors were encountered: