-
Notifications
You must be signed in to change notification settings - Fork 68
Description
I have PIMS 0.6.1 installed with pip on Linux.
I am following trackpy's walkthrough notebook, trying to use my own mp4 video as input.
I open the video using the suggested pipeline:
@pims.pipeline
def gray(image):
return image[:, :, 1] # Take just the green channel
frames = gray(pims.open('/test/test_001.mp4'))
When I try to inspect the video as shown in the notebook (ie using the instruction frame), I get the following error:
File av/stream.pyx:112, in av.stream.Stream.__getattr__()
AttributeError: 'av.video.codeccontext.VideoCodecContext' object has no attribute 'long_name'
Just in case I also tried opening the file without the pipeline, using:
frames = pims.as_grey(pims.open('/test/test_001.mp4'))
But I get the same error. This error is not present when I open an image sequence (maybe because in that case PIMS uses another plugin?). I have originally posted this as a trackpy issue and the problem might be related to PyAv version (I am using PyAv ver 10.0.0 and according to this comment it should work with the previous stable version, 9.0.2)
Full output with the error message:
AttributeError Traceback (most recent call last)
File ~/.virtualenvs/VirtEnvRG001_daily/lib/python3.10/site-packages/IPython/core/formatters.py:708, in PlainTextFormatter.__call__(self, obj)
701 stream = StringIO()
702 printer = pretty.RepresentationPrinter(stream, self.verbose,
703 self.max_width, self.newline,
704 max_seq_length=self.max_seq_length,
705 singleton_pprinters=self.singleton_printers,
706 type_pprinters=self.type_printers,
707 deferred_pprinters=self.deferred_printers)
--> 708 printer.pretty(obj)
709 printer.flush()
710 return stream.getvalue()
File ~/.virtualenvs/VirtEnvRG001_daily/lib/python3.10/site-packages/IPython/lib/pretty.py:410, in RepresentationPrinter.pretty(self, obj)
407 return meth(obj, self, cycle)
408 if cls is not object \
409 and callable(cls.__dict__.get('__repr__')):
--> 410 return _repr_pprint(obj, self, cycle)
412 return _default_pprint(obj, self, cycle)
413 finally:
File ~/.virtualenvs/VirtEnvRG001_daily/lib/python3.10/site-packages/IPython/lib/pretty.py:778, in _repr_pprint(obj, p, cycle)
776 """A pprint that just redirects to the normal repr function."""
777 # Find newlines and replace them with p.break_()
--> 778 output = repr(obj)
779 lines = output.splitlines()
780 with p.group():
File ~/.virtualenvs/VirtEnvRG001_daily/lib/python3.10/site-packages/slicerator/__init__.py:466, in Pipeline.__repr__(self)
463 anc_str = ", ".join(type(a).__name__ for a in self._ancestors)
464 msg = '({0},) processed through {1}. Original repr:\n '.format(
465 anc_str, self._proc_func.__name__)
--> 466 old = [repr(a).replace('\n', '\n ') for a in self._ancestors]
467 return msg + "\n ----\n ".join(old)
File ~/.virtualenvs/VirtEnvRG001_daily/lib/python3.10/site-packages/slicerator/__init__.py:466, in <listcomp>(.0)
463 anc_str = ", ".join(type(a).__name__ for a in self._ancestors)
464 msg = '({0},) processed through {1}. Original repr:\n '.format(
465 anc_str, self._proc_func.__name__)
--> 466 old = [repr(a).replace('\n', '\n ') for a in self._ancestors]
467 return msg + "\n ----\n ".join(old)
File ~/.virtualenvs/VirtEnvRG001_daily/lib/python3.10/site-packages/pims/pyav_reader.py:267, in PyAVReaderTimed.__repr__(self)
257 def __repr__(self):
258 # May be overwritten by subclasses
259 return """<Frames>
260 Format: {format}
261 Source: {filename}
262 Duration: {duration:.3f} seconds
263 Frame rate: {frame_rate:.3f} fps
264 Length: {count} frames
265 Frame Shape: {frame_shape!r}
266 """.format(frame_shape=self.frame_shape,
--> 267 format=self._stream.long_name,
268 duration=self.duration,
269 frame_rate=self.frame_rate,
270 count=len(self),
271 filename=self.file)
File av/stream.pyx:112, in av.stream.Stream.__getattr__()
AttributeError: 'av.video.codeccontext.VideoCodecContext' object has no attribute 'long_name'