程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Passing double quote shell commands in python to subprocess. Popen()?

編輯:Python

problem :

I've been trying to pass a command that works only with literal double quotes in the commandline around the "concat:file1|file2" argument for ffmpeg. I've been trying to pass a command , This command is only available on the command line ffmpeg Of "concat:file1|file2" The literal double quotation marks around the parameter .

I cant however make this work from python with subprocess.Popen() . however , I can't use the subprocess.Popen() python Finish the work .Anyone have an idea how one passes quotes into subprocess.Popen? Anyone knows how to pass quotation marks to subprocess.Popen?

Here is the code: This is the code. :

command = "ffmpeg -i "concat:1.ts|2.ts" -vcodec copy -acodec copy temp.mp4"output,error = subprocess.Popen(command, universal_newlines=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate()

When I do this, ffmpeg won't take it any other way other than quotes around the concat segement. When I do this ,ffmpeg In addition to the concat Quote around paragraph , Not in any other way .Is there a way to successfully pass this line to subprocess.Popen command? Is there any way to successfully pass this line to subprocess.Popen command ?


Solution :

Reference resources : https://stackoom.com/en/question/10dg4

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved