It just needed shell=True at the end. The final working code:
result = subprocess.run(["ffprobe", "-hide_banner", "-v", "quiet", "-show_entries",
"format=duration", "-of",
"default=noprint_wrappers=1:nokey=1", filename], stdout=subprocess.PIPE, stderr=None, shell=True)