0

需要替换子进程命令中的文件名,即文件名

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)

任何不同的看法。我无法看到它。

4

1 回答 1

0
q = "D\:/imagesequence/thumbnail.jpg"
task = "movie= '%s'[watermark]; [in][watermark] overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/3 [out]" % q

c = subprocess.check_call(["ffmpeg", "-i", "D:/imagesequence/background222.jpg", "-vf", task, "D:/imagesequence/fwtm106.jpg"],shell=True)

这行得通。谢谢至

http://comments.gmane.org/gmane.comp.python.tutor/65858

于 2012-07-06T06:27:22.177 回答