需要替换子进程命令中的文件名,即文件名
filename = '\'D\:/imagesequence/thumbnail.jpg\''
task = '\"movie= ' + filename + '[watermark]; [in][watermark] overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/3 [out]\"'
c = subprocess.check_call(["ffmpeg", "-i", "D:/imagesequence/background222.jpg", "-vf", 任务, "D:/imagesequence/fwtm108.jpg"],shell=True)
这给出了错误
# Error: CalledProcessError: Command '['ffmpeg', '-i', 'D:/imagesequence/background222.jpg', '-vf', '"movie= \'D\\:/imagesequence/thumbnail.jpg\'[watermark];[in][watermark] overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/3 [out]"', 'D:/imagesequence/fwtm107.jpg']' returned non-zero exit status 1 #
总而言之,它运作良好
c = subprocess.check_call(["ffmpeg", "-i", "D:/imagesequence/background222.jpg", "-vf", "movie= 'D\:/imagesequence/thumbnail.jpg'[watermark]; [in][watermark] overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/3 [out]", "D:/imagesequence/fwtm101.jpg"],shell=True)
即使这样也有效
task = "movie= 'D\:/imagesequence/thumbnail.jpg'[watermark]; [in][watermark] overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/3 [out]"
c = subprocess.check_call(["ffmpeg", "-i", "D:/imagesequence/background222.jpg", "-vf", task, "D:/imagesequence/fwtm102.jpg"],shell=True)
任何不同的看法。我无法看到它。