Skip to content

Mydia 2.0

Compare
Choose a tag to compare
@MrinalJain17 MrinalJain17 released this 19 Sep 22:37
· 43 commits to master since this release
7530078

Release 2.0.0

Major Features and Improvements

  • Scikit-video has been dropped as the backend for mydia. ( #13 )

    • ffmpeg-python will now be used as the backend providing bindings between python and ffmpeg
  • Support for Custom Frame Selection ( #6 )

    • The mode can now take a callable, that should return the indices of the frames to be selected from the video. For example -

      from mydia import Videos
      
      def custom(total_frames, num_frames, fps):
          # Selecting the frames at even indexes
          return list(range(0, total_frames, 2))
      
      reader = Videos(target_size=(480, 360), to_gray=False, num_frames=36, mode=custom)
    • Detailed explaination and examples will be demonstrated in the documentation

Breaking Changes

  • There is no "manual" mode for frame selection now. The parameter required_fps has been removed as the requirement of such a feature did not seem much useful and was complicating the code unnecessarily.

    • With this change, the parameter extract_position had no such explicit use, and therefore its functionality has been merged with mode. That is -
      • extract_position has been removed
      • mode now supports "first", "last" and "middle" along with "auto" and "random"
    • These modifications have significantly reduced the complexity of the code base. Also, any such requirement for frame extraction can now be fulfilled by using custom callables to mode
  • plot() is not a part of the class Videos anymore

    • Videos is now exclusively for reading the videos, and plot() is available as a standalone function in mydia.py
    • The change inflicted by this is that plot will take as argument only a video and the option of passing the path of the video has now been removed. Everything else, however, is expected to work in the same way as before.

    Earlier

    from mydia import Videos
    reader = Videos()
    video = reader.read("/path/to/video")
    reader.plot(video[0])

    Now

    from mydia import Videos, plot
    reader = Videos()
    video = reader.read("/path/to/video")
    plot(video[0])

Bug Fixes and Other Changes

  • "random" mode for frame selection would have repeated certain frames due to a bug in the previous releases' logic. (Fixed)
  • Frame resizing earlier used ANTIALIAS filter via Pillow. Now, the default filter of ffmpeg - BICUBIC - is used for resizing.
    • In most situations, it is comparatively faster

A comparison, between version 1.0 and 2.0 could be released, but initial tests show that the speed of reading videos have increase by as much as 6x