TypeError: 'function' object is not subscriptable Python with ffmpeg

早过忘川 提交于 2020-03-25 16:17:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!