Skip to content

Latest commit

 

History

History
63 lines (44 loc) · 2.13 KB

video.rst

File metadata and controls

63 lines (44 loc) · 2.13 KB

Video

PIMS provides reading of video through video-pyav, ImageIO <video-imageio-moviepy> or MoviePy <video-imageio-moviepy>.

PyAV (fastest)

PyAV can be installed via Anaconda, as follows:

conda install av -c conda-forge

Non-anaconda users will have to compile PyAV themselves, which is complicated, especially on Windows. For this we refer the users to the PyAV documentation.

There are two ways PIMS provides random access to video files, which is not something that video formats natively support:

  • PyAVReaderTimed <pims.PyAVReaderTimed> bases the indices of the video frames on the frame_rate that is reported by the video file, along with the timestamps that are imprinted on the separate video frames. The readers PyAVVideoReader and Video are different names for this reader.
  • PyAVReaderIndexed <pims.PyAVReaderIndexed> scans through the entire video to build a table of contents. This means that opening the file can take some time, but once it is open, random access is fast. In the case timestamps or frame_rate` are not available, this reader is the preferred option.

pims.PyAVReaderTimed

pims.PyAVReaderIndexed

ImageIO and MoviePy

imageio-ffmpeg and moviepy can be installed via Anaconda, as follows:

conda install imageio-ffmpeg -c conda-forge
conda install moviepy -c conda-forge

Both ImageIO and MoviePy implement interfaces with ffmpeg through a Pipe. These are implemented through ImageIOReader <pims.ImageIOReader> and MoviePyReader <pims.MoviePyReader>, respectively.

pims.ImageIOReader