

Using 'raw' strings using the r"" prefix avoids having to double every backslash.By avoiding this altogether and constructing the argument list explicitly, it just works. Since you didn't quote the filenames containing the space, my bet is that shlex couldn't split it properly. Not used shlex to parse the string we construct ourselves."""Find the resolution of the input video file."""įfpath = r"C:\cygwin64\home\Sybren\ffmpeg\bin\ffprobe.exe"Īrgs = + "-v quiet -print_format json -show_streams".split() + įfout = subprocess.check_output(args).decode('utf-8') This works fine on my machine (Win10, Blender 2.79, ffmpeg 3.2): import bpyĭef find_video_metadata(video_path: str) -> (int, int): I tried to put raw strings, to do several things to avoid spaces in the cmd launched by the subprocess, but it doesn't work. Width = ffprobeOutputįile="C:\\Users\\tonton\\Documents\\TAF\\CODE\\work Blender Edit\\test sequence\\test_002.JPG" # run the ffprobe process, decode stdout into utf-8 & convert to JSONįfprobeOutput = subprocess.check_output(args).decode('utf-8')įfprobeOutput = json.loads(ffprobeOutput)

# function to find the resolution of the input video fileįfpath="C:\\Program Files\\ffmpeg-3.3.1-win64-static\\bin\\ffprobe.exe"Ĭmd = ffpath+" -v quiet -print_format json -show_streams" I found a lot of piece of code to do that online, but they all returned same kind of errors. Basically, i want a little function to retrieve media informations, and return them. I'm having difficulties on an addon to help importing and organizing files in the VSE timeline.
