Skip to content

Commit d7a0afd

Browse files
author
chenxinfeng
committed
urgent fix the bug
1 parent 8104d77 commit d7a0afd

File tree

4 files changed

+26
-12
lines changed

4 files changed

+26
-12
lines changed

ffmpegcv/ffmpeg_reader.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import sys
66
import select
77
from .video_info import (
8-
run_async,
8+
run_async_reader as run_async,
99
get_info,
1010
get_num_NVIDIA_GPUs,
1111
decoder_to_nvidia,
@@ -254,14 +254,14 @@ def read(self):
254254
if self.waitInit:
255255
self.process = run_async(self.ffmpeg_cmd)
256256
self.waitInit = False
257-
257+
258258
in_bytes = self.process.stdout.read(np.prod(self.out_numpy_shape))
259-
260259
# check if ffmpeg process error
261-
stderrreadable, _, _ = select.select([self.process.stderr], [], [], 0)
262-
if stderrreadable:
263-
data = self.process.stderr.read(1024)
264-
sys.stderr.buffer.write(data)
260+
# if self.process.stderr.readable():
261+
# print('---a')
262+
# data = self.process.stderr.read()
263+
# sys.stderr.buffer.write(data)
264+
# print('---f')
265265

266266
if not in_bytes:
267267
self.release()

ffmpegcv/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__='0.3.17'
1+
__version__='0.3.18'

ffmpegcv/video_info.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,27 @@ def run_async(args):
192192
bufsize=bufsize,
193193
)
194194

195+
def run_async_reader(args):
196+
bufsize = -1
197+
if isinstance(args, str):
198+
args = shlex.split(args)
199+
200+
return Popen(
201+
args,
202+
stdin=None,
203+
stdout=PIPE,
204+
stderr=subprocess.DEVNULL,
205+
shell=False,
206+
bufsize=bufsize,
207+
)
208+
195209

196210
def release_process(process: Popen, forcekill=False):
197-
if hasattr(process, "stdin"):
211+
if hasattr(process, "stdin") and process.stdin is not None:
198212
process.stdin.close()
199-
if hasattr(process, "stdout"):
213+
if hasattr(process, "stdout") and process.stdout is not None:
200214
process.stdout.close()
201-
if hasattr(process, "stderr"):
215+
if hasattr(process, "stderr") and process.stderr is not None:
202216
process.stderr.close()
203217
if forcekill and hasattr(process, "terminate") and not _is_windows:
204218
process.terminate()

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
setup(
99
name="ffmpegcv", # 应用名
10-
version="0.3.17", # 版本号
10+
version="0.3.18", # 版本号
1111
packages=find_packages(include=["ffmpegcv*"]), # 包括在安装包内的 Python 包
1212
author="chenxf",
1313
author_email="cxf529125853@163.com",

0 commit comments

Comments
 (0)