scikit-video icon indicating copy to clipboard operation
scikit-video copied to clipboard

Numpy deprecation

Open rk-exxec opened this issue 2 years ago • 3 comments

I hade several errors when using this library on a fresh install. Its because of the numpy deprecation of several datatypes:
https://numpy.org/doc/stable/release/1.20.0-notes.html

I replaced them all with the equivalent python variants, which is the suggested procedure as far as I could tell.

All tests passed!

platform win32 -- Python 3.9.4, pytest-7.2.1, pluggy-1.0.0
rootdir: C:\Users\krr38985\Documents\Python\scikit-video
collected 47 items

skvideo\tests\test_IOfail.py ...                                                                                                                                                                                       [  6%]
skvideo\tests\test_ffmpeg.py ....                                                                                                                                                                                      [ 14%]
skvideo\tests\test_libav.py sssssss                                                                                                                                                                                    [ 29%] 
skvideo\tests\test_measure.py s.........                                                                                                                                                                               [ 51%]
skvideo\tests\test_motion.py .......                                                                                                                                                                                   [ 65%]
skvideo\tests\test_path.py .s                                                                                                                                                                                          [ 70%]
skvideo\tests\test_pattern.py .s.s                                                                                                                                                                                     [ 78%]
skvideo\tests\test_scenedet.py .                                                                                                                                                                                       [ 80%]
skvideo\tests\test_vread.py .....                                                                                                                                                                                      [ 91%]
skvideo\tests\test_vreader.py .s                                                                                                                                                                                       [ 95%]
skvideo\tests\test_vwrite.py ..                                                                                                                                                                                        [100%]

===================================================================================================== warnings summary ====================================================================================================== 
.venv\lib\site-packages\nose\importer.py:12
  c:\users\krr38985\documents\python\scikit-video\.venv\lib\site-packages\nose\importer.py:12: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses   
    from imp import find_module, load_module, acquire_lock, release_lock

skvideo/tests/test_ffmpeg.py: 5 warnings
skvideo/tests/test_pattern.py: 4 warnings
skvideo/tests/test_vread.py: 4 warnings
skvideo/tests/test_vwrite.py: 5 warnings
  C:\Users\krr38985\Documents\Python\scikit-video\skvideo\io\abstract.py:514: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
    self._proc.stdin.write(vid.tostring())

skvideo/tests/test_measure.py::test_measure_VideoBliinds
  C:\Users\krr38985\Documents\Python\scikit-video\skvideo\measure\videobliinds.py:63: FutureWarning: Unlike other reduction functions (e.g. `skew`, `kurtosis`), the default behavior of `mode` typically preserves the axis it acts along. In SciPy 1.11.0, this behavior will change: the default value of `keepdims` will become False, the `axis` over which the statistic is taken will be eliminated, and the value None will no longer be accepted. Set `keepdims` to True or False to avoid this warning.
    mode10x10[i] = scipy.stats.mode(motion_amplitude, axis=None)[0]

skvideo/tests/test_path.py::test_FFmpeg_paths
  C:\Users\krr38985\Documents\Python\scikit-video\skvideo\__init__.py:306: UserWarning: ffmpeg/ffprobe not found in path: /
    warnings.warn("ffmpeg/ffprobe not found in path: " + str(path), UserWarning)

skvideo/tests/test_vread.py::test_vread_raw2_libav_aboveversion9
  c:\users\krr38985\documents\python\scikit-video\.venv\lib\site-packages\_pytest\python.py:199: PytestReturnNotNoneWarning: Expected None, but skvideo/tests/test_vread.py::test_vread_raw2_libav_aboveversion9 returned 0, which will be an error in a future version of pytest.  Did you mean to use `assert` instead of `return`?
    warnings.warn(

skvideo/tests/test_vwrite.py::test_vreader_libav
  c:\users\krr38985\documents\python\scikit-video\.venv\lib\site-packages\_pytest\python.py:199: PytestReturnNotNoneWarning: Expected None, but skvideo/tests/test_vwrite.py::test_vreader_libav returned 0, which will be an 
error in a future version of pytest.  Did you mean to use `assert` instead of `return`?
    warnings.warn(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================================================= 35 passed, 12 skipped, 23 warnings in 27.77s ======================================================================================== 

rk-exxec avatar Feb 15 '23 17:02 rk-exxec

This also fixes np.complex and np.str which is missed in the other PR

rk-exxec avatar Feb 15 '23 17:02 rk-exxec

This is exactly what I needed, really unfortunate that the library seems to be no longer actively maintained :(

vasilNnikolov avatar Mar 09 '23 21:03 vasilNnikolov

@vasilNnikolov Yeah, its a real shame, this has fit my needs perfectly. I have switched to imageio with the pyav plugin for reading videos. https://imageio.readthedocs.io/en/stable/examples.html#read-or-iterate-frames-in-a-video

It works pretty similar, is not as well documented though.

import imageio.v3 as iio
vr = iio.imread(filename, plugin="pyav", format="gray")
        
color_channels = vr[0].shape[-1]
number_of_frames = vr[0].shape[0]
meta = iio.immeta(filename)
frame_rate = meta['fps']

I have not used any advanced functionality of skvideo, so I cant really say if and how well those are implemented.

rk-exxec avatar Mar 10 '23 14:03 rk-exxec