From 99d094a006d9c7ad5c6b6d4dc4b6c45b3fc9c953 Mon Sep 17 00:00:00 2001 From: Greg Hogan Date: Wed, 18 Oct 2023 18:31:14 -0700 Subject: [PATCH] fix ffprobe on device (#30286) * fix ffprobe on device * use FileReader * no more requests old-commit-hash: 59e947dc6c70f515e887cc2e09ed2ea0b39fa679 --- tools/lib/framereader.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/tools/lib/framereader.py b/tools/lib/framereader.py index 8ab9e10edc..d0c7a31947 100644 --- a/tools/lib/framereader.py +++ b/tools/lib/framereader.py @@ -61,16 +61,14 @@ def fingerprint_video(fn): def ffprobe(fn, fmt=None): fn = resolve_name(fn) - cmd = ["ffprobe", - "-v", "quiet", - "-print_format", "json", - "-show_format", "-show_streams"] + cmd = ["ffprobe", "-v", "quiet", "-print_format", "json", "-show_format", "-show_streams"] if fmt: cmd += ["-f", fmt] - cmd += [fn] + cmd += ["-i", "-"] try: - ffprobe_output = subprocess.check_output(cmd) + with FileReader(fn) as f: + ffprobe_output = subprocess.check_output(cmd, input=f.read(4096)) except subprocess.CalledProcessError as e: raise DataUnreadableError(fn) from e