Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用python和ffmpeg从DICT列表中的两个值进行for循环_Python_List_For Loop_Ffmpeg_Timecodes - Fatal编程技术网

使用python和ffmpeg从DICT列表中的两个值进行for循环

使用python和ffmpeg从DICT列表中的两个值进行for循环,python,list,for-loop,ffmpeg,timecodes,Python,List,For Loop,Ffmpeg,Timecodes,在我的第一个非常有用的python程序中,我遇到了一个问题,即如何执行最后一个for循环。我正试图用ffmpeg根据一系列逻辑分割视频,以找出编辑点 我有一个字典列表“cut_list”,我是这样整理出来的 [{'Cutstart': '01:00:00:00', 'CutEnd': '01:00:05:00'}, {'Cutstart': '01:00:10:01', 'CutEnd': '01:00:15:00'}, {'Cutstart': '01:00:20:01', 'CutEnd':

在我的第一个非常有用的python程序中,我遇到了一个问题,即如何执行最后一个for循环。我正试图用ffmpeg根据一系列逻辑分割视频,以找出编辑点

我有一个字典列表“cut_list”,我是这样整理出来的

[{'Cutstart': '01:00:00:00', 'CutEnd': '01:00:05:00'}, {'Cutstart': '01:00:10:01', 'CutEnd': '01:00:15:00'}, {'Cutstart': '01:00:20:01', 'CutEnd': '01:00:25:01'}]
然后,我尝试将这些值输入到ffmpeg,在dict列表上迭代,如下所示:

cutcounter=1
for Cutstart & CutEnd in cut_list:
    for k in Cutstart.items() & v in CutEnd.items() :
        print(k)
        print(v)
        intime=Timecode(fps_real, k)
        intime.set_fractional(True)
        outtime=Timecode(fps_real, v)
        outtime.set_fractional(True)
        cutfile=str(cutcounter)+".mxf"
        print(k)
        print(v)
        subprocess.call(['ffmpeg', '-i', "C:\\path\\to\\file\\BaseFile.mxf", '-ss', k, '-to', v, '-c:v', 'copy', '-c:a', 'copy', cutfile])
        cutcounter=cutcounter+1
我的预期输出是迭代列表,并在特定的时间码和编号为1.mxf的位置分割视频块,并计算每个for循环,以与插入到这些时间跨度的修复程序重新组合。我认为在我计算出for循环之后,我还需要将timecode值作为HH:mm:ss:mss而不是HH:mm:ss:ff输入,但这并不是我目前难以计算的部分。现在,我只是无法摸索将每个时间码的cutstart和cutend输入ffmpeg脚本的逻辑

当我把头撞在墙上试图变得更聪明时,当前的错误是:
语法错误:无法分配给操作员


我绝对没有经验,并且从很多其他有用的帖子中拼凑出了这个,但是我在排序和列表、dicts列表、tuple列表等方面都很困难,以及在哪里和什么时候使用每一个

问题在于您的for循环。这将显示如何循环遍历dict列表。问题在于for循环。这将显示如何循环遍历dict列表。