Skip to content
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

Add packages moviepy and sounddevice #428

Closed
arman00 opened this issue Nov 15, 2016 · 25 comments
Closed

Add packages moviepy and sounddevice #428

arman00 opened this issue Nov 15, 2016 · 25 comments

Comments

@arman00
Copy link

arman00 commented Nov 15, 2016

How about including moviepy and sounddevice packages? They are the most practical ones I have seen so far, especially very useful for people working in video and audio signal processing fields.

http://zulko.github.io/moviepy/
https://pypi.python.org/pypi/sounddevice/

@stonebig
Copy link
Contributor

moviepy is big in size, when you include "highly recommanded" dependancies to get something usefull.

Maintenance work is proportional to total size of all binaries uploaded, and a too-big-binary can be a repulsive factor for users.

sounddevice is written "3 - Alpha" software and not in listed cgohlke papers.

@hiccup7
Copy link

hiccup7 commented Nov 21, 2016

Please note that PyAudio (included in WinPython) also has a development status of "3 - Alpha" at https://pypi.python.org/pypi/PyAudio/

My experience with my USB external DAC is that sounddevice works using the WDM-KS and WASAPI shared mode host APIs, while PyAudio in WinPython does not. I find sounddevice easier to use and better documented. sounddevice is super simple to play an entire NumPy array.

PyAudio was available long before the sounddevice project even started, so consider that sounddevice was created because its developer was dissatisfied with PyAudio.

The sounddevice developer creates his own DLLs for Windows, which I have been using. If a sounddevice user has a problem using ASIO, WDM-KS or WASAPI host APIs, the user can ask for help or submit a PR to the sounddevice project and get a quick response (in my experience). On the contrary, we can't expect any help from cgohlke on issues with these host APIs on Windows with PyAudio.

To save WinPython maintenance work and yet serve the needs of users, I suggest replacing PyAudio with sounddevice.

@arman00
Copy link
Author

arman00 commented Nov 21, 2016

sounddevice:
I agree with hiccup7. I had some trouble with PyAudio and it was too much effort to do even simple things. This is why I am using sounddevice all the time.

moviepy:
moviepy is not big. It depends on Numpy, imageio, Decorator, and tqdm. Numpy and decorator is already included in WinPython. After installing moviepy it took 10MB more space which is insignificant compared to the size of WinPython installation. Moreover, having imageio and tqdm would also be nice.

Moviepy installs the ffmpeg dependency automatically only in the first use, so for people who actually do not use moviepy, there is no disk space penalty. After all ffmpeg is a pretty standard and very functional tool. I have never needed and installed other optional dependencies, ImageMagick, opencv, pygame. Moviepy is really very simple to use, neatly wraps ffmpeg, and even the functionality of the basic installation is more than enough for me. I found it after frustration and troubles with other video editing libraries.

I think including these two libraries can save people who need audio and video processing capabilities from a lot of effort.

@stonebig
Copy link
Contributor

basic problem is the sound_device wheel name decoding

@hiccup7
Copy link

hiccup7 commented Nov 22, 2016

@arman00 - You could remove one barrier to your request for sounddevice by providing the patch requested in issue #423. This would remove some of the burden from @stonebig (who is providing a big and valuable contribution to the Python community).

@stonebig
Copy link
Contributor

apparently, sounddevice is now supported by Christoph Gohlke, and the wheel name is back to "normal".

@hiccup7
Copy link

hiccup7 commented Nov 23, 2016

@stonebig - Thanks for letting us know about the good news!

@arman00 - Let's report here our testing results with Gohlke's build of sounddevice.

@stonebig stonebig added this to the 2016-06 Spyder-3.0.2+ / Jupyterlab-0.9.2 / WinPython-3.6.0.1 milestone Nov 23, 2016
@hiccup7
Copy link

hiccup7 commented Nov 23, 2016

Replacing libportaudio64bit.dll with the one from the portaudio-19.6.0-win branch at https://github.com/spatialaudio/portaudio-binaries I got WASAPI working with both exclusive mode and shared mode!

@cgohlke - Thanks for building and posting Sounddevice package wheels. I tested your wheel with CPython 3.5, and no WASAPI devices are available from sounddevice.query_devices(). But the comment for the Sounddevice package on your site suggests you intended to support WASAPI. Could you rebuild with a fix?

@cgohlke
Copy link

cgohlke commented Nov 23, 2016

PA_USE_WASAPI is ON in my builds of portaudio v190600 but hostapi/wasapi/pa_win_wasapi.c does not seem to be included in the CMake generated solution file. Looks like an issue in portaudio's CMakeLists.txt.

@cgohlke
Copy link

cgohlke commented Nov 23, 2016

I patched portaudio's CMakeLists.txt and rebuilt. Windows WASAPI devices are showing up now.

@hiccup7
Copy link

hiccup7 commented Nov 23, 2016

@cgohlke - Thanks for the updated wheels. I tested them with 64-bit CPython 3.4 and 3.5 (install with WinPython Control Panel). WASAPI devices are available, and WASAPI exclusive mode works well!

A note to others: if you installed a sounddevice wheel from PyPI, after you uninstall it with the WinPython Control Panel, you will need to manually delete the _sounddevice_data folder. cgohlke's wheels are now the simplest way to get the PortAudio fixes and installation with the WinPython Control Panel.

@hiccup7
Copy link

hiccup7 commented Nov 24, 2016

@cgohlke has http://www.lfd.uci.edu/~gohlke/pythonlibs/#simpleaudio
I have been using this to play a beep through my default sound device when my hour-long scripts finish executing. The main advantage of simpleaudio is no dependencies. However, I am getting tired of having to install simpleaudio into each new WinPython distribution.

Now that sounddevice is working so well, I changed my beep() function to use it instead of simpleaudio. I plan to install sounddevice into each new WinPython distribution anyway. WinPython already contains all of the dependencies of sounddevice. For simple 16-bit WAV playing, I use scipy.io.wavfile.read() and sounddevice.play(). Thus, playing a 16-bit WAV file to the default sound device is as simple with sounddevice as it is with simpleaudio. For use in my WinPython distribution, I don't need simpleaudio anymore. If WinPython includes sounddevice in future builds, it is even more convenient for me.

@stonebig
Copy link
Contributor

stonebig commented Nov 26, 2016

sounddevice added to the list. it's not a heavy package

@stonebig
Copy link
Contributor

I understand that for imageio, there is the true need to understand in wppm this nice "-cp26.cp27.cp33.cp34.cp35-none-win_amd64" specification

@stonebig
Copy link
Contributor

stonebig commented Nov 27, 2016

checking more closely:

  • soundevice is ok, as the dll are provided in the wheel,
  • imageio is not ok, because dlls are not provided in the wheel
  • moviepy seems .... not moving anymore ? so not ok.

@arman00
Copy link
Author

arman00 commented Nov 27, 2016

Thank you for sounddevice and looking at compliance of moviepy.
Moviepy is like a mature and completed project, maybe this is why there is no further development. I don't know about the dlls in the wheel. Anyway I can use pip install for moviepy whenever I need. Thanks.

@stonebig
Copy link
Contributor

the 4 Mo size of imageio-p2-py3-cp27-cp28-...-cp36 is just coming 80% from the included ".png" and ".mp4" examples.

@stonebig
Copy link
Contributor

stonebig commented Nov 27, 2016

Almar Klien is going to remove "freeimage" dll / use in next week release, but that leaves many other dlls coming down live on your pc, or not coming down at all.

@arman00
Copy link
Author

arman00 commented Nov 27, 2016

I didn't know there will be a missing dll problem in the next weeks, not sure what to do to make moviepy work then, I don't have expertise about proper installation of these libraries.

@hiccup7
Copy link

hiccup7 commented Nov 27, 2016

I would not like WinPython connecting to the internet at installation as this opens up a security vulnerability. Teachers and other security-concerned users install WinPython on the admin account with admin privileges. When users with standard privileges (students) run code that attempts runtime installation in the admin account, it will fail.

I would rather see either everything included with the WinPython installer or let users manually download from PyPI. No drive-by downloads!

@stonebig
Copy link
Contributor

stonebig commented Nov 28, 2016

Almar seems to say that only freeimage was downloaded, and this week it will disappear. In that case, I'll include it

@hiccup7
Copy link

hiccup7 commented Dec 3, 2016

I tested the latest 64-bit Python 3.5 sounddevice wheel from @cgohlke with my external USB DAC using the following host APIs: WDM-KS, ASIO, WASAPI exclusive mode, and WASAPI shared mode. It worked perfectly.

If WinPython is built using the wheel from https://pypi.python.org/pypi/sounddevice/ , you would need to manually replace the bundled DLL with the one from https://github.com/spatialaudio/portaudio-binaries/tree/19.6.0-windows
It would be much simpler to just use Golke's wheel, which already bundles the v19.6.0 PortAudio DLL.

Golke's PyAudio package uses \Lib\site-packages\_portaudio.cp35-win_amd64.pyd
Golke's sounddevice package uses \Lib\site-packages\portaudio_x64.dll
While both packages can be installed at the same time without conflict (because one uses _portaudio and the other uses portaudio), it may be confusing for users about which DLL each one uses.

I recommend removing PyAudio from the next WinPython release because:

  1. sounddevice supports the same functionality plus much more
  2. Reduce the WinPython download size
  3. Users with PyAudio dependencies can still download Golke's wheel
  4. Less confusion about which PYD/DLL is used by sounddevice
  5. New WinPython users will go directly to the best package for sound I/O

@hiccup7
Copy link

hiccup7 commented Dec 26, 2016

I installed WinPython-64bit-3.5.2.4Qt5b3.exe, and I see it includes Golke's wheel for sounddevice. Thank you!

Any comment on my last post in this thread about removing PyAudio?

@stonebig
Copy link
Contributor

pyaudio is tiny and I have Python-3.6 wheels for it, so there is no physical pressure to remove it

@stonebig
Copy link
Contributor

imageio will be in next release.

moviepy is not moving since march 17th 2016, so won't be include in Winpython for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants