heoLixfy
heoLixfy

Reputation: 161

ffmpeg Invalid file index 3 in filtergraph description

It works fine:

Command:

[
  '-r',
  '30',
  '-f',
  'image2',
  '-s',
  '1920x1080',
  '-start_number',
  '0',
  '-i',
  'element-%03d.jpeg',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\74db7ea0dc2503f3b7a9b28e67bc3de1.mp4',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\19ef2c514ba66f5c2f250a3629a7ed5d.mp4',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\74db7ea0dc2503f3b7a9b28e67bc3de1.mp4',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\19ef2c514ba66f5c2f250a3629a7ed5d.mp4',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\24f635c7e376ddc40fac5888bbd9e9df.mp3',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\24f635c7e376ddc40fac5888bbd9e9df.mp3',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\88f3f8400479852b0b80d4a5a868754c.mp3',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\74db7ea0dc2503f3b7a9b28e67bc3de1.mp4',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\19ef2c514ba66f5c2f250a3629a7ed5d.mp4',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\74db7ea0dc2503f3b7a9b28e67bc3de1.mp4',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\19ef2c514ba66f5c2f250a3629a7ed5d.mp4',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\9d2f98c54e1705a5474f86c30088d7c5.mp4',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\f455e5ca0037fff469da8bb201d5382d.mp4',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\9d2f98c54e1705a5474f86c30088d7c5.mp4',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\f455e5ca0037fff469da8bb201d5382d.mp4',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\ccfde51e37a0f61e6b989dde5b59ea17.mp3',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\ccfde51e37a0f61e6b989dde5b59ea17.mp3',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\66f1717caa354aac299369b2e6e0dea7.mp3',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\9d2f98c54e1705a5474f86c30088d7c5.mp4',
  '-i',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***ZGhZzo\\f455e5ca0037fff469da8bb201d5382d.mp4',
  '-c:v',
  'libx264',
  '-crf',
  '18',
  '-pix_fmt',
  'yuv420p',
  '-b:v',
  '1M',
  '-c:a',
  'aac',
  '-filter_complex_script',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\\***\\complex-filter.txt',
  '-map',
  '0:v',
  '-y',
  'E:\\***\\2\\trailer\\out.mp4'
]

where 'C:\Users\Admin\AppData\Local\Temp\***\complex-filter.txt' is

[1:a]atrim=0.000:2.500,adelay=667|667|667,atempo=1.00000,volume=13:eval=once[a1];[3:a]atrim=0.000:2.500,adelay=3167|3167|3167,atempo=1.00000,volume=12:eval=once[a3];[5:a]atrim=0.000:2.000,adelay=6667|6667,atempo=1.00000,volume=11:eval=once[a5];[6:a]atrim=0.000:2.000,adelay=8667|8667,atempo=1.00000,volume=10:eval=once[a6];[7:a]atrim=0.000:2.000,adelay=10667|10667,atempo=1.00000,volume=9:eval=once[a7];[8:a]atrim=0.000:2.500,adelay=12667|12667|12667,atempo=1.00000,volume=8:eval=once[a8];[10:a]atrim=0.000:2.500,adelay=15167|15167|15167,atempo=1.00000,volume=7:eval=once[a10];[12:a]atrim=0.000:3.500,adelay=18667|18667|18667,atempo=1.00000,volume=6:eval=once[a12];[14:a]atrim=0.000:3.500,adelay=22167|22167|22167,atempo=1.00000,volume=5:eval=once[a14];[16:a]atrim=0.000:2.000,adelay=26667|26667,atempo=1.00000,volume=4:eval=once[a16];[17:a]atrim=0.000:2.000,adelay=28667|28667,atempo=1.00000,volume=3:eval=once[a17];[18:a]atrim=0.000:2.000,adelay=30667|30667,atempo=1.00000,volume=2:eval=once[a18];[19:a]atrim=0.000:0.667,adelay=32667|32667|32667,atempo=1.00000,volume=1:eval=once[a19];[a1][a3][a5][a6][a7][a8][a10][a12][a14][a16][a17][a18][a19]amix=inputs=13:dropout_transition=0:duration=longest

It doesn't work:

Command:

[
  '-r',
  '30',
  '-f',
  'image2',
  '-s',
  '1920x1080',
  '-start_number',
  '0',
  '-i',
  'element-%03d.jpeg',
  '-safe', //-- new
  '0',//-- new
  '-f',//-- new
  'concat',//-- new
  '-i',//-- new
  'e:\\***\\trailer\\video-assets.txt',//-- new
  '-c:v',
  'libx264',
  '-crf',
  '18',
  '-pix_fmt',
  'yuv420p',
  '-b:v',
  '1M',
  '-c:a',
  'aac',
  '-filter_complex_script',
  'C:\\Users\\Admin\\AppData\\Local\\Temp\***\\complex-filter.txt',
  '-map',
  '0:v',
  '-y',
  'E:\\***\\trailer\\out.mp4'
]

Where 'e:\***\trailer\video-assets.txt' is:

file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/74db7ea0dc2503f3b7a9b28e67bc3de1.mp4'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/19ef2c514ba66f5c2f250a3629a7ed5d.mp4'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/74db7ea0dc2503f3b7a9b28e67bc3de1.mp4'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/19ef2c514ba66f5c2f250a3629a7ed5d.mp4'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/24f635c7e376ddc40fac5888bbd9e9df.mp3'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/24f635c7e376ddc40fac5888bbd9e9df.mp3'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/88f3f8400479852b0b80d4a5a868754c.mp3'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/74db7ea0dc2503f3b7a9b28e67bc3de1.mp4'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/19ef2c514ba66f5c2f250a3629a7ed5d.mp4'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/74db7ea0dc2503f3b7a9b28e67bc3de1.mp4'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/19ef2c514ba66f5c2f250a3629a7ed5d.mp4'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/9d2f98c54e1705a5474f86c30088d7c5.mp4'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/f455e5ca0037fff469da8bb201d5382d.mp4'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/9d2f98c54e1705a5474f86c30088d7c5.mp4'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/f455e5ca0037fff469da8bb201d5382d.mp4'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/ccfde51e37a0f61e6b989dde5b59ea17.mp3'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/ccfde51e37a0f61e6b989dde5b59ea17.mp3'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/66f1717caa354aac299369b2e6e0dea7.mp3'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/9d2f98c54e1705a5474f86c30088d7c5.mp4'
    file 'file:C:/Users/Admin/AppData/Local/Temp/***graphicsvzl5Po/f455e5ca0037fff469da8bb201d5382d.mp4'

Where 'C:\Users\Admin\AppData\Local\Temp***\complex-filter.txt' is:

[1:a]atrim=0.000:2.500,adelay=667|667|667,atempo=1.00000,volume=13:eval=once[a1];[3:a]atrim=0.000:2.500,adelay=3167|3167|3167,atempo=1.00000,volume=12:eval=once[a3];[5:a]atrim=0.000:2.000,adelay=6667|6667,atempo=1.00000,volume=11:eval=once[a5];[6:a]atrim=0.000:2.000,adelay=8667|8667,atempo=1.00000,volume=10:eval=once[a6];[7:a]atrim=0.000:2.000,adelay=10667|10667,atempo=1.00000,volume=9:eval=once[a7];[8:a]atrim=0.000:2.500,adelay=12667|12667|12667,atempo=1.00000,volume=8:eval=once[a8];[10:a]atrim=0.000:2.500,adelay=15167|15167|15167,atempo=1.00000,volume=7:eval=once[a10];[12:a]atrim=0.000:3.500,adelay=18667|18667|18667,atempo=1.00000,volume=6:eval=once[a12];[14:a]atrim=0.000:3.500,adelay=22167|22167|22167,atempo=1.00000,volume=5:eval=once[a14];[16:a]atrim=0.000:2.000,adelay=26667|26667,atempo=1.00000,volume=4:eval=once[a16];[17:a]atrim=0.000:2.000,adelay=28667|28667,atempo=1.00000,volume=3:eval=once[a17];[18:a]atrim=0.000:2.000,adelay=30667|30667,atempo=1.00000,volume=2:eval=once[a18];[19:a]atrim=0.000:0.667,adelay=32667|32667|32667,atempo=1.00000,volume=1:eval=once[a19];[a1][a3][a5][a6][a7][a8][a10][a12][a14][a16][a17][a18][a19]amix=inputs=13:dropout_transition=0:duration=longest

Exception:

Duration: 00:00:33.33, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 30 tbn, 30 tbc
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000249a23b10c0] Auto-inserting h264_mp4toannexb bitstream filter
Input #1, concat, from 'e:\***\trailer\video-assets.txt':
  Duration: N/A, start: -0.021333, bitrate: 446 kb/s
    Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 319 kb/s, 23.98 fps, 23.98 tbr, 11988 tbn, 47.95 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 126 kb/s
    Metadata:
      handler_name    : SoundHandler
Invalid file index 3 in filtergraph description [1:a]atrim=0.000:2.500,adelay=667|667|667,atempo=1.00000,volume=13:eval=once[a1];[3:a]atrim=0.000:2.500,adelay=3167|3167|3167,atempo=1.00000,volume=12:eval=once[a3];[5:a]atrim=0.000:2.000,adelay=6667|6667,atempo=1.00000,volume=11:eval=once[a5];[6:a]atrim=0.000:2.000,adelay=8667|8667,atempo=1.00000,volume=10:eval=once[a6];[7:a]atrim=0.000:2.000,adelay=10667|10667,atempo=1.00000,volume=9:eval=once[a7];[8:a]atrim=0.000:2.500,adelay=12667|12667|12667,atempo=1.00000,volume=8:eval=once[a8];[10:a]atrim=0.000:2.500,adelay=15167|15167|15167,atempo=1.00000,volume=7:eval=once[a10];[12:a]atrim=0.000:3.500,adelay=18667|18667|18667,atempo=1.00000,volume=6:eval=once[a12];[14:a]atrim=0.000:3.500,adelay=22167|22167|22167,atempo=1.00000,volume=5:eval=once[a14];[16:a]atrim=0.000:2.000,adelay=26667|26667,atempo=1.00000,volume=4:eval=once[a16];[17:a]atrim=0.000:2.000,adelay=28667|28667,atempo=1.00000,volume=3:eval=once[a17];[18:a]atrim=0.000:2.000,adelay=30667|30667,atempo=1.00000,volume=2:eval=once[a18];[19:a]atrim=0.000:0.667,adelay=32667|32667|32667,atempo=1.00000,volume=1:eval=once[a19];[a1][a3][a5][a6][a7][a8][a10][a12][a14][a16][a17][a18][a19]amix=inputs=13:dropout_transition=0:duration=longest.

I've only modified commands. I've replaced '-i filename -i filename -i filename' on '-safe 0 -f concat -i e:***\trailer\video-assets.txt'. Where is my mistake?

Upvotes: 1

Views: 352

Answers (1)

Gyan
Gyan

Reputation: 93261

The concat demuxer concatenates all its file references and emits it as a single input in serial order, so ffmpeg has only two inputs in the new command. All your filter script references to [2] and above are no longer valid. You can only apply filters to [0] and [1].

Upvotes: 1

Related Questions