我正在尝试将视频(高度和宽度)缩放 1.8,但在运行上述代码后,视频没有任何变化。不知道这里有什么问题。
import subprocess
import ffmpeg
def crop(input_file, output_file, x, y):
subprocess.call(['ffmpeg', '-i', input_file, '-filter:v', 'scale=.{}/{}*iw:ih'.format(x, y), output_file])
crop('/Users/Aaron/Desktop/reil1.mp4', '/Users/Aaron/Desktop/reil2.mp4', 1.8, 1.8)
最佳答案
基本上,你不能用 1.8 进行扩展,我猜是 1.8,
尝试通过有效的分辨率,如 640、480
例如 -
import subprocess
import ffmpeg
def crop(input_file, output_file, x, y):
subprocess.call(['ffmpeg', '-i', input_file, '-filter:v', 'scale=.{}/{}*iw:ih'.format(x, y), output_file])
crop('/Users/Aaron/Desktop/reil1.mp4', '/Users/Aaron/Desktop/reil2.mp4', 640, 480)
关于python - FFmpeg 使用 python 缩放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69420847/