Skip to content

Commit cd6d64c

Browse files
author
arch
committed
close the subrocess at the end
1 parent 0a52a76 commit cd6d64c

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

funscript_editor/data/equirectangularvideostream.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def __init__(self,
6161
self.thread.daemon = True
6262
self.thread.start()
6363

64+
__logger = logging.getLogger(__name__)
6465

6566
@staticmethod
6667
def get_perspective(
@@ -226,17 +227,17 @@ def run(self) -> None:
226227
""" Function to read transformed frames from ffmpeg video stream into a queue """
227228

228229
command = ['ffmpeg',
229-
'-hide_banner', '-loglevel', 'warning',
230-
'-ss', str(self.start_timestamp),
231-
'-i', self.video_path,
232-
'-f', 'image2pipe',
233-
'-pix_fmt', 'bgr24',
234-
'-vsync', '0',
235-
'-vcodec', 'rawvideo',
236-
'-an','-sn', # disable audio processing
237-
'-vf', 'v360=input=he:in_stereo=sbs:pitch=' + str(self.PHI) + ':output=flat:d_fov=' \
238-
+ str(self.FOV) + ':w=' + str(self.width) + ':h=' + str(self.height),
239-
'-']
230+
'-hide_banner', '-loglevel', 'warning',
231+
'-ss', str(self.start_timestamp),
232+
'-i', self.video_path,
233+
'-f', 'image2pipe',
234+
'-pix_fmt', 'bgr24',
235+
'-vsync', '0',
236+
'-vcodec', 'rawvideo',
237+
'-an','-sn', # disable audio processing
238+
'-vf', 'v360=input=he:in_stereo=sbs:pitch=' + str(self.PHI) + ':output=flat:d_fov=' \
239+
+ str(self.FOV) + ':w=' + str(self.width) + ':h=' + str(self.height),
240+
'-']
240241

241242
pipe = sp.Popen(command, stdout=sp.PIPE, bufsize=4*self.height*self.width)
242243

@@ -253,8 +254,9 @@ def run(self) -> None:
253254
self.Q.put(frame)
254255
self.current_frame += 1
255256

256-
# TODO add log entry
257+
pipe.terminate()
257258
self.stopped = True
259+
self.__logger.info('close ffmpeg stream')
258260

259261

260262
def get_resolution(self) -> tuple:

0 commit comments

Comments
 (0)