我在 minikube 中有一个用于视频编辑任务的 pod,我正在使用 moviepy 库。出现了无法读取文件时长的问题,我深入调试代码,并使用 ffmpeg 找到了原因。
from __future__ import division
import logging
import os
import re
import subprocess as sp
import warnings
import numpy as np
from moviepy.compat import DEVNULL, PY3
from moviepy.config import get_setting # ffmpeg, ffmpeg.exe, etc...
from moviepy.tools import cvsecs
is_GIF = False
cmd = [get_setting("FFMPEG_BINARY"), "-i", "https://videorenderingbucket.s3.ap-south-1.amazonaws.com/video_file/The+Breathtaking+Beauty+of+Nature+-+HD.mp4"]
if is_GIF:
cmd += ["-f", "null", "/dev/null"]
popen_params = {"bufsize": 10**5,"stdout": sp.PIPE,"stderr": sp.PIPE,"stdin": DEVNULL}
if os.name == "nt":
popen_params["creationflags"] = 0x08000000
proc = sp.Popen(cmd, **popen_params)
(output, error) = proc.communicate()
infos = error.decode('utf8')
print(infos)