ffmpeg Operation not permitted

在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:

  • https://blog.csdn.net/ZHENFENGSHISAN/article/details/100785169
  • https://blog.csdn.net/first_shun/article/details/108502532

你可能感兴趣的:(#,tools,ffmpeg)