慕斯王
OP 讨论了 256 个视频的缩放问题。就此而言,我建议使用自动化,例如使用 Python。我们可以看到这部分会随着视频数量的变化而变化:假设你有一个 python 中所有视频的列表(你可以手动完成,但我建议os.listdir像这样使用)以同样的方式,您必须生成过滤器的输入overlay,这将取决于您的输出分辨率。假设它是由width和height变量定义的。grid_width另外,在我的示例中,网格(和)的视频数量grid_width是手动设置的。这是一个代码示例,我没有资源或时间来测试,但这应该是您工作的良好基础:###list_videos contains the path the the videoswidth = 1920height = 1080input_videos = ""input_setpts = "nullsrc=size={}x{} [base];".format(width, height)input_overlays = "[base][video0] overlay=shortest=1 [tmp0];"grid_width = 16grid_height = 16for index, path_video in enumerate(list_video): input_videos += " -i " + path_video input_setpts += "[{}:v] setpts=PTS-STARTPTS, scale={}x{} [video{}];".format(index, width//grid_width, height//grid_height, index) if index > 0 and index < len(list_video) - 1: input_overlays += "[tmp{}][video{}] overlay=shortest=1:x={}:y={} [tmp{}];".format(index-1, index, width//grid_width * (index%grid_width), height//grid_height * (index//grid_width), index) if index == len(list_video) - 1: input_overlays += "[tmp{}][video{}] overlay=shortest=1:x={}:y={}".format(index-1, index, width//grid_width * (index%grid_width), height//grid_height * (index//grid_width))complete_command = "ffmpeg" + input_videos + " -filter_complex \"" + input_setpts + input_overlays + "\" -c:v libx264 output.mp4"print(complete_command)