TypeError:' function'ffmpeg对象无法下标Python [英] TypeError: 'function' object is not subscriptable Python with ffmpeg

查看:72
本文介绍了TypeError:' function'ffmpeg对象无法下标Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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.

问题代码:

subprocess.call(['***', '-i', '"concat:' + clipString() + '"', '-c', 'copy', '-bsf:a aac_adtstoasc', 'output.mp4'])

所有带有*的地方都是路径,例如:/davidscomputer/bin/ffmpeg/

all places with * were paths such as: /davidscomputer/bin/ffmpeg/

推荐答案

subprocess.call()根据定义是可调用的.你错过了它周围的括号

subprocess.call() is a callable by definition. You missed the brackets around it

subprocess.call(['***','-i','"concat:'+ clipString()+'"','-c','copy','-bsf:aaac_adtstoasc','output.mp4'])

这篇关于TypeError:' function'ffmpeg对象无法下标Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆