numpyimage 2.6.2__tar.gz → 2.6.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: numpyimage
3
- Version: 2.6.2
3
+ Version: 2.6.4
4
4
  Summary: Load, save, & manipulate image files as numpy arrays
5
5
  Author-email: Jasper Phelps <jasper.s.phelps@gmail.com>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -96,12 +96,17 @@ def load_video(filename,
96
96
  data = np.empty((num_frames, *first_img.shape), dtype=first_img.dtype)
97
97
  # Then fill it up frame by frame
98
98
  data[0] = first_img
99
+ container.seek(0, stream=stream)
99
100
  for i, frame in tqdm(enumerate(frame_iter), total=num_frames,
100
101
  desc='Loading video', disable=not progress_bar):
101
- if i == 0:
102
- continue
103
102
  img = frame.to_ndarray(format='rgb24')
103
+ if i == 0 and not np.array_equal(img, first_img):
104
+ raise RuntimeError('PyAV seek failed. Please report how this happened'
105
+ ' at github.com/jasper-tms/npimage/issues')
104
106
  data[i] = img
107
+ if (data[-1] == 0).all():
108
+ print('WARNING: Last frame of video is all zeros, this may'
109
+ ' indicate an error in video loading unless you expected this.')
105
110
  if return_framerate:
106
111
  return data, float(stream.average_rate)
107
112
  else:
@@ -399,7 +404,7 @@ class VideoWriter:
399
404
  'Set overwrite=True to overwrite.')
400
405
  self.filename = filename
401
406
  self.framerate = str(framerate) # str instead of float to avoid precision issues
402
- while Fraction(self.framerate).denominator >= 2**32 or Fraction(self.framerate).numerator >= 2**32:
407
+ while Fraction(self.framerate).denominator >= 2**31 or Fraction(self.framerate).numerator >= 2**31:
403
408
  # If framerate has too many decimals to be expressed as a
404
409
  # ratio of 32-bit ints, which is required by ffmpeg, crop
405
410
  # off one decimal point of precision until it is expressable
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: numpyimage
3
- Version: 2.6.2
3
+ Version: 2.6.4
4
4
  Summary: Load, save, & manipulate image files as numpy arrays
5
5
  Author-email: Jasper Phelps <jasper.s.phelps@gmail.com>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta'
4
4
 
5
5
  [project]
6
6
  name = 'numpyimage'
7
- version = '2.6.2'
7
+ version = '2.6.4'
8
8
  description = 'Load, save, & manipulate image files as numpy arrays'
9
9
  readme.file = 'README.md'
10
10
  readme.content-type = 'text/markdown'
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes