Browse Source
fix bug
Signed-off-by: junjie.jiang <junjie.jiang@zilliz.com>
main
2 changed files with
4 additions and
3 deletions
-
cpu_decode.py
-
video_decoder.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 |
|
|
|
|
|
@ -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: |
|
|
|