logo
Browse Source

fix bug

Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
main
junjie.jiang 1 year ago
parent
commit
2af7625996
  1. 3
      cpu_decode.py
  2. 4
      video_decoder.py

3
cpu_decode.py

@ -9,7 +9,8 @@ logger = logging.getLogger()
class PyAVDecode:
def __init__(self, video_path, start_time=None, time_step=None) -> None:
def __init__(self, video_path, gpu_id=0, start_time=None, time_step=None) -> None:
# gpu_id is useless, consistent with the gpu decode
self._container = av.open(video_path)
self._stream = self._container.streams.video[0]
self._start_time = start_time if start_time is not None else 0

4
video_decoder.py

@ -41,13 +41,13 @@ class VideoDecoder(PyOperator):
yield from VPFDecode(video_path, self._gpu_id, self._start_time).decode()
def _cpu_decode(self, video_path):
yield from PyAVDecode(video_path, self._start_time).decode()
yield from PyAVDecode(video_path, self._gpu_id, self._start_time).decode()
def _gpu_time_step_decode(self, video_path, time_step):
yield from VPFDecode(video_path, self._gpu_id, self._start_time, time_step).time_step_decode()
def _cpu_time_step_decode(self, video_path, time_step):
yield from PyAVDecode(video_path, self._start_time, time_step).time_step_decode()
yield from PyAVDecode(video_path, self._gpu_id, self._start_time, time_step).time_step_decode()
def decode(self, video_path: str):
try:

Loading…
Cancel
Save