python - 类型错误 : 'function' object is not subscriptable Python with ffmpeg

标签 python ffmpeg subprocess concatenation

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']

我正在尝试制作一个剪辑连接器,但最后一个子进程调用不会运行并给我问题中显示的错误。

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

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

最佳答案

subprocess.call()根据定义是可调用的。你错过了它周围的括号
subprocess.call(['***', '-i', '"concat:' + clipString() + '"', '-c', 'copy', '-bsf:a aac_adtstoasc', 'output.mp4'])

关于python - 类型错误 : 'function' object is not subscriptable Python with ffmpeg,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59026080/

相关文章:

Python 将 "5.4"但不是 "5.4.4"转换为 float ,这是怎么回事?

javascript - 在 Electron 中支持 HEVC/H.265 视频

video - ffmpeg 将多个文件从 avi dv 视频 (dvsd) 转换为 avi h.264 + mp3(mp4)

使用偏移量调用时 FFMPEG 失败

python - 来自已完成子进程的 stdout.read() 有时会返回空值?

python - 命令在 CMD 中有效,但在子进程中无效

python - 查找表示为列表的边

python - 有没有办法通过 Airflow API 创建/修改连接

写入数据科学标准输出时,Python 进程因 "Low Swap"而终止

C++ float 到 Python float 的错误转换