Skip to content

Commit

Permalink
update: Video2ImageProcessor의 call을 동기식으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
404Vector committed Nov 28, 2023
1 parent 118461e commit fc1b926
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions v2v/_video2image_processor_.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,20 @@ def __init__(self, video_path: str, ffmpeg_options_output: Optional[dict] = None
self._progress = 0
self._is_done = False

async def __call__(self) -> FrameData:
def __call__(self) -> FrameData:
assert self._is_done is False
frame = await asyncio.to_thread(
functools.partial(
read_frame_from_process,
process=self._sub_processor,
width=self._video_info.frame_width,
height=self._video_info.frame_height,
)
frame = read_frame_from_process(
process=self._sub_processor,
width=self._video_info.frame_width,
height=self._video_info.frame_height,
)

if frame is not None:
frame_data = FrameData(frame_id=self._progress, frame=frame)
self._progress += 1
else:
self._is_done = True
frame_data = FrameData(frame_id=-1, frame=None)
frame_data = None
self._sub_processor.stdout.close()
self._sub_processor.wait()
return frame_data
Expand Down

0 comments on commit fc1b926

Please sign in to comment.