问题
clips = []
def clipFinder(CurrentDir, fileType):
clips.clear()
for r,d,f in os.walk(CurrentDir):
for file in f:
if fileType in file:
clips.append(r+file)
random.shuffle(clips)
def removeVods(r):
for f in clips:
if 'vod' in clips:
os.remove(r+f)
def clipString():
string = 'intermediate'
clipList = []
clipNum = 1
for f in clips:
clipList.append(string+str(clipNum)+'.ts'+'|')
clipNum+=1
string1 = ''.join(clipList)
string2 = string1[0:len(string1)-1]
return string2
def concatFiles():
clipFinder('***', '.mp4')
removeVods('***')
i = 0
intermediates = []
for f in clips:
subprocess.call(['***', '-i', clips[i], '-c', 'copy', '-bsf:v', 'h264_mp4toannexb', '-f', 'mpegts', 'intermediate'+ str(i+1) +'.ts'])
i += 1
clipsLength = len(clips)
subprocess.call['***', '-i', '"concat:' + clipString() + '"', '-c', 'copy', '-bsf:a
aac_adtstoasc', 'output.mp4']
I am trying to make a clip concatenator, but the last subprocess call won't run and gives me the error shown in the question.
Problematic code:
subprocess.call(['***', '-i', '"concat:' + clipString() + '"', '-c', 'copy', '-bsf:a aac_adtstoasc', 'output.mp4'])
all places with * were paths such as: /davidscomputer/bin/ffmpeg/
回答1:
subprocess.call()
is a callable by definition. You missed the brackets around it
subprocess.call(['***', '-i', '"concat:' + clipString() + '"', '-c', 'copy', '-bsf:a aac_adtstoasc', 'output.mp4'])
来源:https://stackoverflow.com/questions/59026080/typeerror-function-object-is-not-subscriptable-python-with-ffmpeg