在ffmpeg合并视频的时候报这个错,一开始以为权限问题,后来发现是文件不安全,加 -safe 0
修改后代码:
def mer_mp4(*args, save_path):
tmp = Path(args[0]) / Path(args[0]).parent / Path('video.txt')
f = open(tmp, 'w')
for mp4 in args:
write_str = "file \'{}\'\n".format(mp4)
f.write(write_str)
f.close()
os.system('ffmpeg -f concat -safe 0 -i {} -c copy {}'.format(tmp, save_path))
# ffmpeg -f concat -i video.txt -c copy concat.mp4
ref: